diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-08-20 11:52:48 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-08-20 11:52:48 +0200 |
commit | 150c9fe5363d96c248b1ad3b19316c2d3ad5824d (patch) | |
tree | 7a3a988674f54f9c3417d796b8e4a8936c9260e8 /Eigen/src/QR | |
parent | 2b15e001068f548b852d58472b9b29f1a7bf1a2c (diff) |
Make FullPivHouseholderQR::solve returns the least-square solution instead of aborting if no exact solution exist
Diffstat (limited to 'Eigen/src/QR')
-rw-r--r-- | Eigen/src/QR/FullPivHouseholderQR.h | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index 0dd5ad347..611467367 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -126,11 +126,12 @@ template<typename _MatrixType> class FullPivHouseholderQR } /** This method finds a solution x to the equation Ax=b, where A is the matrix of which - * *this is the QR decomposition, if any exists. + * \c *this is the QR decomposition. * * \param b the right-hand-side of the equation to solve. * - * \returns a solution. + * \returns the exact or least-square solution if the rank is greater or equal to the number of columns of A, + * and an arbitrary solution otherwise. * * \note The case where b is a matrix is not yet implemented. Also, this * code is space inefficient. @@ -516,17 +517,6 @@ struct solve_retval<FullPivHouseholderQR<_MatrixType>, Rhs> dec().hCoeffs().coeff(k), &temp.coeffRef(0)); } - if(!dec().isSurjective()) - { - // is c is in the image of R ? - RealScalar biggest_in_upper_part_of_c = c.topRows( dec().rank() ).cwiseAbs().maxCoeff(); - RealScalar biggest_in_lower_part_of_c = c.bottomRows(rows-dec().rank()).cwiseAbs().maxCoeff(); - // FIXME brain dead - const RealScalar m_precision = NumTraits<Scalar>::epsilon() * (std::min)(rows,cols); - // this internal:: prefix is needed by at least gcc 3.4 and ICC - if(!internal::isMuchSmallerThan(biggest_in_lower_part_of_c, biggest_in_upper_part_of_c, m_precision)) - return; - } dec().matrixQR() .topLeftCorner(dec().rank(), dec().rank()) .template triangularView<Upper>() |