matrix
matrix copied to clipboard
Get pseudoinverse in browser
Hi! I'm making a webpage where I'll need to calculate a pseudoinverse. However, I can't get the pseudoInverse function to work in a browser... Any suggestions would be extremely welcome! `
<html>
<head>
<title>Test Matrix library</title>
<script src="https://www.lactame.com/lib/ml/6.0.0/ml.min.js"></script>
</head>
<script>
// ML-MATRIX with web link
const A = ML.Matrix.eye(6,6); //This works
const B = A.pseudoInverse(); //This does not work
</script>
</html>
`
Thanks very much in advance!
Can you give more details about what doesn't work, ideally a reproduction of the issue that we can test ourselves?
Thanks for the quick reply!
Sure, the error is get is: Uncaught TypeError: A.pseudoInverse is not a function
As shown in the code above, I took the example from the readme page:
var pseudoInverse = A.pseudoInverse();
This is an error in the readme. pseudoInverse
is no longer an instance method (since version 6.0.0): https://mljs.github.io/matrix/modules.html#pseudoInverse
Thanks both, that explains it and solved my issue!
To compute my pseudoInverse:
const A = ML.Matrix.eye(6,6); const B = ML.MatrixLib.pseudoInverse(A);
Please close this