Pew
Pew

Reputation: 101

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

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

Upvotes: 0

Views: 38

Answers (0)

Related Questions