[英]Eigen solver for sparse matrix product
我想使用 Eigen 來計算 L_1^{-1}L_2,其中 L_1 和 L_2 都是下三角矩陣,並在 Eigen 中存儲為面向列的稀疏矩陣。 我嘗試了本征三角求解器。 但是,這需要 L_2 是密集的。
實際上,對於稀疏rhs, solve
方法並沒有重載,但是您可以像這樣使用solveInPlace
方法(我實際上沒有嘗試過):
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;
}
您仍然應該考慮是否確實需要完整的矩陣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.