matrix icon indicating copy to clipboard operation
matrix copied to clipboard

Get pseudoinverse in browser

Open roelandheerema opened this issue 2 years ago • 4 comments

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!

roelandheerema avatar Nov 23 '21 01:11 roelandheerema

Can you give more details about what doesn't work, ideally a reproduction of the issue that we can test ourselves?

stropitek avatar Nov 23 '21 09:11 stropitek

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();

roelandheerema avatar Nov 23 '21 14:11 roelandheerema

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

targos avatar Nov 23 '21 15:11 targos

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);

roelandheerema avatar Nov 23 '21 16:11 roelandheerema

Please close this

Dimava avatar Nov 05 '22 11:11 Dimava