问题
When factorize a 34918 x 34918 sparse matrix, it takes about 1'20" to factorize it (only a few sec to build the sparse matrix). Can sparse matrix be factorized with multi threads? (visual studio)
Here is the code:
Eigen::SparseMatrix<double> laplacian(verticesNum, verticesNum);
// reserve space for non-zero elements in sparse matrix
laplacian.reserve(Eigen::VectorXi::Constant(verticesNum, 20));
// build matrix operator
for (int i = 0; i < vertices->size(); i++)
{
// ... some algorithm
}
// build solver for matrix
Eigen::SparseLU<Eigen::SparseMatrix<double>, Eigen::COLAMDOrdering<int>> solver;
// tailor solver to matrix
solver.analyzePattern(laplacian);
solver.factorize(laplacian);
After stepped in, I found out the last line solver.factorize(laplacian) takes more than 1 min to execute. Can I use multi threads to fasten it?
Thank you!!
来源:https://stackoverflow.com/questions/62386137/can-eigen-matrix-solver-use-multi-threads-and-how