diff options
author | 2016-04-07 16:28:44 -0700 | |
---|---|---|
committer | 2016-04-07 16:28:44 -0700 | |
commit | fd872aefb3a9a0e4be08e66671494babdb921c2b (patch) | |
tree | 57ff6f1fd30796c3d7b109b81a6d052347cc6204 | |
parent | 0b5546d182928acb428daba0787755180da4b3fc (diff) |
Remove transpose() method from LLT and LDLT classes as it would imply conjugation.
Explicitly cast constants to RealScalar in ConditionEstimator.h.
-rw-r--r-- | Eigen/src/Cholesky/LDLT.h | 3 | ||||
-rw-r--r-- | Eigen/src/Cholesky/LLT.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/ConditionEstimator.h | 31 |
3 files changed, 22 insertions, 15 deletions
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h index 902376fd6..d246a459c 100644 --- a/Eigen/src/Cholesky/LDLT.h +++ b/Eigen/src/Cholesky/LDLT.h @@ -217,9 +217,8 @@ template<typename _MatrixType, int _UpLo> class LDLT MatrixType reconstructedMatrix() const; /** \returns the decomposition itself to allow generic code to do - * ldlt.transpose().solve(rhs). + * ldlt.adjoint().solve(rhs). */ - const LDLT<MatrixType, UpLo>& transpose() const { return *this; }; const LDLT<MatrixType, UpLo>& adjoint() const { return *this; }; inline Index rows() const { return m_matrix.rows(); } diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h index dc2ccd6a4..f88afe8b5 100644 --- a/Eigen/src/Cholesky/LLT.h +++ b/Eigen/src/Cholesky/LLT.h @@ -170,9 +170,8 @@ template<typename _MatrixType, int _UpLo> class LLT } /** \returns the decomposition itself to allow generic code to do - * llt.transpose().solve(rhs). + * llt.adjoint().solve(rhs). */ - const LLT<MatrixType, UpLo>& transpose() const { return *this; }; const LLT<MatrixType, UpLo>& adjoint() const { return *this; }; inline Index rows() const { return m_matrix.rows(); } diff --git a/Eigen/src/Core/ConditionEstimator.h b/Eigen/src/Core/ConditionEstimator.h index 9027aa2f7..19c6102f7 100644 --- a/Eigen/src/Core/ConditionEstimator.h +++ b/Eigen/src/Core/ConditionEstimator.h @@ -27,7 +27,8 @@ template <typename Vector, typename RealVector, bool IsComplex> struct SignOrUnity { static inline Vector run(const Vector& v) { const RealVector v_abs = v.cwiseAbs(); - return (v_abs.array() == 0).select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); + return (v_abs.array() == static_cast<typename Vector::RealScalar>(0)) + .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); } }; @@ -35,7 +36,8 @@ struct SignOrUnity { template <typename Vector> struct SignOrUnity<Vector, Vector, false> { static inline Vector run(const Vector& v) { - return (v.array() < 0).select(-Vector::Ones(v.size()), Vector::Ones(v.size())); + return (v.array() < static_cast<typename Vector::RealScalar>(0)) + .select(-Vector::Ones(v.size()), Vector::Ones(v.size())); } }; @@ -65,7 +67,7 @@ typename Decomposition::RealScalar ReciprocalConditionNumberEstimate( eigen_assert(matrix.cols() == dec.cols()); eigen_assert(matrix.rows() == matrix.cols()); if (dec.rows() == 0) { - return Decomposition::RealScalar(1); + return static_cast<typename Decomposition::RealScalar>(1); } return ReciprocalConditionNumberEstimate(MatrixL1Norm(matrix), dec); } @@ -89,15 +91,20 @@ typename Decomposition::RealScalar ReciprocalConditionNumberEstimate( template <typename Decomposition> typename Decomposition::RealScalar ReciprocalConditionNumberEstimate( typename Decomposition::RealScalar matrix_norm, const Decomposition& dec) { + typedef typename Decomposition::RealScalar RealScalar; eigen_assert(dec.rows() == dec.cols()); if (dec.rows() == 0) { - return 1; + return static_cast<RealScalar>(1); } - if (matrix_norm == 0) { - return 0; + if (matrix_norm == static_cast<RealScalar>(0)) { + return static_cast<RealScalar>(0); } - const typename Decomposition::RealScalar inverse_matrix_norm = InverseMatrixL1NormEstimate(dec); - return inverse_matrix_norm == 0 ? 0 : (1 / inverse_matrix_norm) / matrix_norm; + const typename Decomposition::RealScalar inverse_matrix_norm = + InverseMatrixL1NormEstimate(dec); + return (inverse_matrix_norm == static_cast<RealScalar>(0) + ? static_cast<RealScalar>(0) + : (static_cast<RealScalar>(1) / inverse_matrix_norm) / + matrix_norm); } /** @@ -115,7 +122,8 @@ typename Decomposition::RealScalar ReciprocalConditionNumberEstimate( * ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be * computed directly in O(n^2) operations. * - * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and LLT. + * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and + * LLT. * * \sa FullPivLU, PartialPivLU, LDLT, LLT. */ @@ -126,7 +134,8 @@ typename Decomposition::RealScalar InverseMatrixL1NormEstimate( typedef typename Decomposition::Scalar Scalar; typedef typename Decomposition::RealScalar RealScalar; typedef typename internal::plain_col_type<MatrixType>::type Vector; - typedef typename internal::plain_col_type<MatrixType, RealScalar>::type RealVector; + typedef typename internal::plain_col_type<MatrixType, RealScalar>::type + RealVector; const bool is_complex = (NumTraits<Scalar>::IsComplex != 0); eigen_assert(dec.rows() == dec.cols()); @@ -188,7 +197,7 @@ typename Decomposition::RealScalar InverseMatrixL1NormEstimate( // exact cancellation (especially when op and op_adjoint correspond to a // sequence of backsubstitutions and permutations), which could cause // Hager's algorithm to vastly underestimate ||matrix||_1. - Scalar alternating_sign = 1; + Scalar alternating_sign(static_cast<RealScalar>(1)); for (int i = 0; i < n; ++i) { v[i] = alternating_sign * (static_cast<RealScalar>(1) + |