I am trying to find the pseudo-inverse of a matrix using the Eigen Library. They have a class that does implement it, however I do not know how to put script the syntax.
This is how it is shown on the website (https://eigen.tuxfamily.org/dox/classEigen_1_1CompleteOrthogonalDecomposition.html#ab2fd4c81aa1cd8bc917c7f135505cb7f):
const Inverse Eigen::CompleteOrthogonalDecomposition< MatrixType >::pseudoInverse ( ) const
It's a method of the CompleteOrthogonalDecomposition
class. So you have to perform that decomposition of a matrix before you use it. For example
#include <Eigen/QR>
Eigen::MatrixXd A = ... // fill in A
Eigen::MatrixXd pinv = A.completeOrthogonalDecomposition().pseudoInverse();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With