Skip to content

Commit 760ff26

Browse files
committed
adding SparseQR
1 parent 768ee9c commit 760ff26

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/polysolve/linear/Solver.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
#include <fstream>
1212

1313
// -----------------------------------------------------------------------------
14+
//
15+
// Subsequent macros assume a single template parameter and SparseQR fails due to requiring 2 parameters. this is because the OrderingType is not filled in.
16+
// SparseLU has a default declaration of _OrderingType to use COLAMDOrdering but SparseQR doesn't - so this just mimics that behavior. If Eigen adds such a default in the future this line will need to be guarded to avoid multiple defaults
17+
namespace Eigen {
18+
template <typename _MatrixType, typename _OrderingType = COLAMDOrdering<typename _MatrixType::StorageIndex> > class SparseQR;
19+
}
1420
#include <Eigen/Sparse>
1521
#ifdef POLYSOLVE_WITH_ACCELERATE
1622
#include <Eigen/AccelerateSupport>
@@ -293,6 +299,10 @@ namespace polysolve::linear
293299
else if (solver == "Eigen::SparseLU")
294300
{
295301
RETURN_DIRECT_SOLVER_PTR(SparseLU, "Eigen::SparseLU");
302+
}
303+
else if (solver == "Eigen::SparseQR")
304+
{
305+
RETURN_DIRECT_SOLVER_PTR(SparseQR, "Eigen::SparseQR");
296306
#ifdef POLYSOLVE_WITH_ACCELERATE
297307
}
298308
else if (solver == "Eigen::AccelerateLLT")
@@ -465,6 +475,7 @@ namespace polysolve::linear
465475
return {{
466476
"Eigen::SimplicialLDLT",
467477
"Eigen::SparseLU",
478+
"Eigen::SparseQR",
468479
#ifdef POLYSOLVE_WITH_ACCELERATE
469480
"Eigen::AccelerateLLT",
470481
"Eigen::AccelerateLDLT",

0 commit comments

Comments
 (0)