I want to use Eigen to compute L_1^{-1}L_2, where both L_1 and L_2 are lower triangular matrices and are stored as column oriented sparse matrices in Eigen. I tried the Eigen triangular solver. However, that requires L_2 to be dense.
1
votes
1 Answers
1
votes
The solve method in fact is not overloaded for sparse rhs, however you can use the solveInPlace method like so (I did not actually try this):
Eigen::SparseMatrix<double> foo(Eigen::SparseMatrix<double> const& L1, Eigen::SparseMatrix<double> const& L2)
{
Eigen::SparseMatrix<double> res = L2;
L1.triangularView<Eigen::Lower>().solveInPlace(res);
return res;
}
Still you should consider if you actually need the full matrix.
L_1^{-1}*L_2will be dense as well. Are you sure, you need to store the matrix, instead of just computing products/solving systems on the fly? - chtz