diff options
Diffstat (limited to 'extern/Eigen3/Eigen/src/LU')
-rw-r--r-- | extern/Eigen3/Eigen/src/LU/Determinant.h | 2 | ||||
-rw-r--r-- | extern/Eigen3/Eigen/src/LU/FullPivLU.h | 10 | ||||
-rw-r--r-- | extern/Eigen3/Eigen/src/LU/Inverse.h | 6 | ||||
-rw-r--r-- | extern/Eigen3/Eigen/src/LU/PartialPivLU.h | 9 |
4 files changed, 20 insertions, 7 deletions
diff --git a/extern/Eigen3/Eigen/src/LU/Determinant.h b/extern/Eigen3/Eigen/src/LU/Determinant.h index d862c5d7784..bb8e78a8a8a 100644 --- a/extern/Eigen3/Eigen/src/LU/Determinant.h +++ b/extern/Eigen3/Eigen/src/LU/Determinant.h @@ -91,7 +91,7 @@ template<typename Derived> struct determinant_impl<Derived, 4> template<typename Derived> inline typename internal::traits<Derived>::Scalar MatrixBase<Derived>::determinant() const { - assert(rows() == cols()); + eigen_assert(rows() == cols()); typedef typename internal::nested<Derived,Base::RowsAtCompileTime>::type Nested; return internal::determinant_impl<typename internal::remove_all<Nested>::type>::run(derived()); } diff --git a/extern/Eigen3/Eigen/src/LU/FullPivLU.h b/extern/Eigen3/Eigen/src/LU/FullPivLU.h index e23f96cdcf1..dfe25f424d7 100644 --- a/extern/Eigen3/Eigen/src/LU/FullPivLU.h +++ b/extern/Eigen3/Eigen/src/LU/FullPivLU.h @@ -293,11 +293,12 @@ template<typename _MatrixType> class FullPivLU */ inline Index rank() const { + using std::abs; eigen_assert(m_isInitialized && "LU is not initialized."); - RealScalar premultiplied_threshold = internal::abs(m_maxpivot) * threshold(); + RealScalar premultiplied_threshold = abs(m_maxpivot) * threshold(); Index result = 0; for(Index i = 0; i < m_nonzero_pivots; ++i) - result += (internal::abs(m_lu.coeff(i,i)) > premultiplied_threshold); + result += (abs(m_lu.coeff(i,i)) > premultiplied_threshold); return result; } @@ -416,6 +417,9 @@ FullPivLU<MatrixType>::FullPivLU(const MatrixType& matrix) template<typename MatrixType> FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix) { + // the permutations are stored as int indices, so just to be sure: + eigen_assert(matrix.rows()<=NumTraits<int>::highest() && matrix.cols()<=NumTraits<int>::highest()); + m_isInitialized = true; m_lu = matrix; @@ -547,6 +551,7 @@ struct kernel_retval<FullPivLU<_MatrixType> > template<typename Dest> void evalTo(Dest& dst) const { + using std::abs; const Index cols = dec().matrixLU().cols(), dimker = cols - rank(); if(dimker == 0) { @@ -632,6 +637,7 @@ struct image_retval<FullPivLU<_MatrixType> > template<typename Dest> void evalTo(Dest& dst) const { + using std::abs; if(rank() == 0) { // The Image is just {0}, so it doesn't have a basis properly speaking, but let's diff --git a/extern/Eigen3/Eigen/src/LU/Inverse.h b/extern/Eigen3/Eigen/src/LU/Inverse.h index 39b8cdbc8dc..3cf8871932f 100644 --- a/extern/Eigen3/Eigen/src/LU/Inverse.h +++ b/extern/Eigen3/Eigen/src/LU/Inverse.h @@ -55,6 +55,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 1> bool& invertible ) { + using std::abs; determinant = matrix.coeff(0,0); invertible = abs(determinant) > absDeterminantThreshold; if(invertible) result.coeffRef(0,0) = typename ResultType::Scalar(1) / determinant; @@ -98,6 +99,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 2> bool& invertible ) { + using std::abs; typedef typename ResultType::Scalar Scalar; determinant = matrix.determinant(); invertible = abs(determinant) > absDeterminantThreshold; @@ -167,6 +169,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 3> bool& invertible ) { + using std::abs; typedef typename ResultType::Scalar Scalar; Matrix<Scalar,3,1> cofactors_col0; cofactors_col0.coeffRef(0) = cofactor_3x3<MatrixType,0,0>(matrix); @@ -251,6 +254,7 @@ struct compute_inverse_and_det_with_check<MatrixType, ResultType, 4> bool& invertible ) { + using std::abs; determinant = matrix.determinant(); invertible = abs(determinant) > absDeterminantThreshold; if(invertible) compute_inverse<MatrixType, ResultType>::run(matrix, inverse); @@ -327,7 +331,7 @@ inline const internal::inverse_impl<Derived> MatrixBase<Derived>::inverse() cons * This is only for fixed-size square matrices of size up to 4x4. * * \param inverse Reference to the matrix in which to store the inverse. - * \param determinant Reference to the variable in which to store the inverse. + * \param determinant Reference to the variable in which to store the determinant. * \param invertible Reference to the bool variable in which to store whether the matrix is invertible. * \param absDeterminantThreshold Optional parameter controlling the invertibility check. * The matrix will be declared invertible if the absolute value of its diff --git a/extern/Eigen3/Eigen/src/LU/PartialPivLU.h b/extern/Eigen3/Eigen/src/LU/PartialPivLU.h index c9ff9dd5a36..740ee694c45 100644 --- a/extern/Eigen3/Eigen/src/LU/PartialPivLU.h +++ b/extern/Eigen3/Eigen/src/LU/PartialPivLU.h @@ -242,7 +242,7 @@ struct partial_lu_impl const Index cols = lu.cols(); const Index size = (std::min)(rows,cols); nb_transpositions = 0; - int first_zero_pivot = -1; + Index first_zero_pivot = -1; for(Index k = 0; k < size; ++k) { Index rrows = rows-k-1; @@ -253,7 +253,7 @@ struct partial_lu_impl = lu.col(k).tail(rows-k).cwiseAbs().maxCoeff(&row_of_biggest_in_col); row_of_biggest_in_col += k; - row_transpositions[k] = row_of_biggest_in_col; + row_transpositions[k] = PivIndex(row_of_biggest_in_col); if(biggest_in_corner != RealScalar(0)) { @@ -318,7 +318,7 @@ struct partial_lu_impl } nb_transpositions = 0; - int first_zero_pivot = -1; + Index first_zero_pivot = -1; for(Index k = 0; k < size; k+=blockSize) { Index bs = (std::min)(size-k,blockSize); // actual size of the block @@ -386,6 +386,9 @@ void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, t template<typename MatrixType> PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix) { + // the row permutation is stored as int indices, so just to be sure: + eigen_assert(matrix.rows()<NumTraits<int>::highest()); + m_lu = matrix; eigen_assert(matrix.rows() == matrix.cols() && "PartialPivLU is only for square (and moreover invertible) matrices"); |