Skip to content

Commit

Permalink
adding SparseQR
Browse files Browse the repository at this point in the history
  • Loading branch information
mtao committed Jan 4, 2025
1 parent 768ee9c commit 760ff26
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/polysolve/linear/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
#include <fstream>

// -----------------------------------------------------------------------------
//
// Subsequent macros assume a single template parameter and SparseQR fails due to requiring 2 parameters. this is because the OrderingType is not filled in.
// 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
namespace Eigen {
template <typename _MatrixType, typename _OrderingType = COLAMDOrdering<typename _MatrixType::StorageIndex> > class SparseQR;
}
#include <Eigen/Sparse>
#ifdef POLYSOLVE_WITH_ACCELERATE
#include <Eigen/AccelerateSupport>
Expand Down Expand Up @@ -293,6 +299,10 @@ namespace polysolve::linear
else if (solver == "Eigen::SparseLU")
{
RETURN_DIRECT_SOLVER_PTR(SparseLU, "Eigen::SparseLU");
}
else if (solver == "Eigen::SparseQR")
{
RETURN_DIRECT_SOLVER_PTR(SparseQR, "Eigen::SparseQR");
#ifdef POLYSOLVE_WITH_ACCELERATE
}
else if (solver == "Eigen::AccelerateLLT")
Expand Down Expand Up @@ -465,6 +475,7 @@ namespace polysolve::linear
return {{
"Eigen::SimplicialLDLT",
"Eigen::SparseLU",
"Eigen::SparseQR",
#ifdef POLYSOLVE_WITH_ACCELERATE
"Eigen::AccelerateLLT",
"Eigen::AccelerateLDLT",
Expand Down

0 comments on commit 760ff26

Please sign in to comment.