Closed
Description
Thank you for your implementation, I use it with great success and satisfaction.
I use SparseRegularInverse as an alternative to SparseCholesky via a template parameter, so I like it when both have the same interface.
I was missing SparseRegularInverse::info(), but it was easy to retrofit.
Noticing the current activity on the code so I thought maybe I should bring this little thing up. Because unfortunately lagging a own github repository set up, the patch is just copied here.
---
include/Spectra/MatOp/SparseRegularInverse.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/Spectra/MatOp/SparseRegularInverse.h b/include/Spectra/MatOp/SparseRegularInverse.h
index 3abd0c1..dcfaec5 100644
--- a/include/Spectra/MatOp/SparseRegularInverse.h
+++ b/include/Spectra/MatOp/SparseRegularInverse.h
@@ -39,6 +39,7 @@ private:
ConstGenericSparseMatrix m_mat;
const int m_n;
Eigen::ConjugateGradient<SparseMatrix> m_cg;
+ int m_info; // status of the decomposition
public:
///
@@ -55,6 +56,9 @@ public:
throw std::invalid_argument("SparseRegularInverse: matrix must be square");
m_cg.compute(mat);
+ m_info = (m_cg.info() == Eigen::Success) ?
+ SUCCESSFUL :
+ NUMERICAL_ISSUE;
}
///
@@ -66,6 +70,12 @@ public:
///
Index cols() const { return m_n; }
+ ///
+ /// Returns the status of the computation.
+ /// The full list of enumeration values can be found in \ref Enumerations.
+ ///
+ int info() const { return m_info; }
+
///
/// Perform the solving operation \f$y=B^{-1}x\f$.
///
--
2.27.0.windows.1
Metadata
Metadata
Assignees
Labels
No labels
Activity