| 115 | |
| 116 | template<class rhs = DenseVector> |
| 117 | class SparseLU : public LinearSolver<SparseMatrix, rhs> |
| 118 | { |
| 119 | private: |
| 120 | bool doSolve(const SparseMatrix &A, const rhs &b, rhs &x) const |
| 121 | { |
| 122 | // Init SparseLU solver (requires square matrices) |
| 123 | Eigen::SparseLU<SparseMatrix> sparseSolver; |
| 124 | // Compute the ordering permutation vector from the structural pattern of A |
| 125 | sparseSolver.analyzePattern(A); |
| 126 | // Compute the numerical factorization |
| 127 | sparseSolver.factorize(A); |
| 128 | |
| 129 | if (sparseSolver.info() == Eigen::Success) |
| 130 | { |
| 131 | // Solve LSE |
| 132 | x = sparseSolver.solve(b); |
| 133 | |
| 134 | return sparseSolver.info() == Eigen::Success; |
| 135 | } |
| 136 | |
| 137 | return false; |
| 138 | } |
| 139 | }; |
| 140 | |
| 141 | template<class rhs = DenseVector> |
| 142 | class SparseQR : public LinearSolver<SparseMatrix, rhs> |
nothing calls this directly
no outgoing calls
no test coverage detected