rank()
基本用法
JacobiSVD<MatrixXd> svd(m);
svd.rank()
#include <iostream>
#include <cstring>
#include "Eigen/Dense"
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd a(3, 3);
a << 1, 2, 0,
3, -1, 1,
0, 2, 0;
MatrixXd b(3, 1);
b << 2,
1,
1;
MatrixXd m = MatrixXd::Zero(3, 3);
m.col(0) = b;
m.col(1) = a * b;
m.col(2) = a * a * b;
cout << m << endl;
JacobiSVD<MatrixXd> svd(m);
cout << svd.rank() << endl;
}