diff --git a/Eigen/src/Core/SolverBase.h b/Eigen/src/Core/SolverBase.h index df2ac8371..5a6dfd425 100644 --- a/Eigen/src/Core/SolverBase.h +++ b/Eigen/src/Core/SolverBase.h @@ -78,6 +78,14 @@ class SolverBase : public EigenBase { template friend struct internal::solve_assertion; + ComputationInfo info() const { + // CRTP static dispatch: Calls the 'info()' method on the derived class. + // Derived must implement 'ComputationInfo info() const'. + // If not implemented, name lookup falls back to this base method, causing + // infinite recursion (detectable by -Winfinite-recursion). + return derived().info(); + } + enum { RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime, diff --git a/Eigen/src/LU/FullPivLU.h b/Eigen/src/LU/FullPivLU.h index a725a7bbf..786cd76da 100644 --- a/Eigen/src/LU/FullPivLU.h +++ b/Eigen/src/LU/FullPivLU.h @@ -78,6 +78,17 @@ class FullPivLU : public SolverBase > typedef PermutationMatrix PermutationPType; typedef typename MatrixType::PlainObject PlainObject; + /** \brief Reports whether the LU factorization was successful. + * + * \note This function always returns \c Success. It is provided for compatibility + * with other factorization routines. + * \returns \c Success + */ + ComputationInfo info() const { + eigen_assert(m_isInitialized && "FullPivLU is not initialized."); + return Success; + } + /** * \brief Default Constructor. * diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h index f09b90e2e..7ea14f576 100644 --- a/Eigen/src/LU/PartialPivLU.h +++ b/Eigen/src/LU/PartialPivLU.h @@ -90,6 +90,17 @@ class PartialPivLU : public SolverBase TranspositionType; typedef typename MatrixType::PlainObject PlainObject; + /** \brief Reports whether the LU factorization was successful. + * + * \note This function always returns \c Success. It is provided for compatibility + * with other factorization routines. + * \returns \c Success + */ + ComputationInfo info() const { + eigen_assert(m_isInitialized && "PartialPivLU is not initialized."); + return Success; + } + /** * \brief Default Constructor. * diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index cae9ae4da..d17344459 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -82,6 +82,17 @@ class FullPivHouseholderQR : public SolverBase::type ColVectorType; typedef typename MatrixType::PlainObject PlainObject; + /** \brief Reports whether the QR factorization was successful. + * + * \note This function always returns \c Success. It is provided for compatibility + * with other factorization routines. + * \returns \c Success + */ + ComputationInfo info() const { + eigen_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); + return Success; + } + /** \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to diff --git a/Eigen/src/QR/HouseholderQR.h b/Eigen/src/QR/HouseholderQR.h index e29737258..497085dbf 100644 --- a/Eigen/src/QR/HouseholderQR.h +++ b/Eigen/src/QR/HouseholderQR.h @@ -75,6 +75,17 @@ class HouseholderQR : public SolverBase> { typedef HouseholderSequence> HouseholderSequenceType; + /** \brief Reports whether the QR factorization was successful. + * + * \note This function always returns \c Success. It is provided for compatibility + * with other factorization routines. + * \returns \c Success + */ + ComputationInfo info() const { + eigen_assert(m_isInitialized && "HouseHolderQR is not initialized."); + return Success; + } + /** * \brief Default Constructor. *