How to compute (row) basis of a sparse matrix in Eigen library?

30 views Asked by At

I am wondering how to extract a (row) basis of a sparse matrix using sparse QR decomposition or other sparse decomposition in Eigen library? When I say a basis, I mean a vector of row indices such that the corresponding rows form a basis of the matrix

I can use the sparse QR decomposition in Eigen to compute the nullspace of a sparse matrix. The code works like the following

Eigen::SparseMatrix<double> m_matrix;
qr.compute(m_matrix.transpose());
Eigen::MatrixXd Q = qr.matrixQ();
Eigen::MatrixXd kernel = Q * Eigen::MatrixXd::Identity(cols, cols).rightCols(cols - qr.rank());

But I am not sure how to extract a basis

0

There are 0 answers