求逆
#include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Matrix3d v= m.inverse();
cout << "Its inverse is:v=" << endl << v << endl;
cout<<"m*v="<<m*v<<endl;
}
Here is the matrix m:
-0.999984 -0.0826997 -0.905911
-0.736924 0.0655345 0.357729
0.511211 -0.562082 0.358593
Its inverse is:v=
-0.370316 -0.888554 -0.0491136
-0.737309 -0.172358 -1.69072
-0.627782 0.996559 0.208558
m*v= 1 -1.11022e-16 0
0 1 0
-5.55112e-17 5.55112e-17 1
Hit any key to continue...