diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-07-27 13:50:23 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-07-27 13:50:23 +0200 |
commit | 94cc30180e5b7bec9399d796945e41245c16afeb (patch) | |
tree | 8a47472dd8b4253ed966485ad2675471eb025e46 | |
parent | 0590c18555bd5d195e29ee6a131285cf0f80f9d1 (diff) |
compilation fixes
-rw-r--r-- | Eigen/src/Core/products/SelfadjointProduct.h | 3 | ||||
-rw-r--r-- | Eigen/src/LU/LU.h | 18 | ||||
-rw-r--r-- | Eigen/src/LU/PartialLU.h | 14 | ||||
-rw-r--r-- | Eigen/src/QR/HessenbergDecomposition.h | 2 | ||||
-rw-r--r-- | Eigen/src/QR/QR.h | 18 | ||||
-rw-r--r-- | Eigen/src/QR/Tridiagonalization.h | 4 | ||||
-rw-r--r-- | test/product_syrk.cpp | 3 | ||||
-rw-r--r-- | test/product_trmv.cpp | 16 |
8 files changed, 35 insertions, 43 deletions
diff --git a/Eigen/src/Core/products/SelfadjointProduct.h b/Eigen/src/Core/products/SelfadjointProduct.h index f6420d10c..d3fc962d9 100644 --- a/Eigen/src/Core/products/SelfadjointProduct.h +++ b/Eigen/src/Core/products/SelfadjointProduct.h @@ -76,9 +76,6 @@ struct ei_selfadjoint_product<Scalar,MatStorageOrder, ColMajor, AAT, UpLo> Scalar* blockA = ei_aligned_stack_new(Scalar, kc*mc); Scalar* blockB = ei_aligned_stack_new(Scalar, kc*size*Blocking::PacketSize); - // number of columns which can be processed by packet of nr columns - int packet_cols = (size/Blocking::nr)*Blocking::nr; - // note that the actual rhs is the transpose/adjoint of mat typedef ei_conj_helper<NumTraits<Scalar>::IsComplex && !AAT, NumTraits<Scalar>::IsComplex && AAT> Conj; diff --git a/Eigen/src/LU/LU.h b/Eigen/src/LU/LU.h index 6e42591e4..2bdcc4512 100644 --- a/Eigen/src/LU/LU.h +++ b/Eigen/src/LU/LU.h @@ -92,7 +92,7 @@ template<typename MatrixType> class LU MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. > ImageResultType; - /** + /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to @@ -227,7 +227,7 @@ template<typename MatrixType> class LU * Example: \include LU_solve.cpp * Output: \verbinclude LU_solve.out * - * \sa MatrixBase::solveTriangular(), kernel(), computeKernel(), inverse(), computeInverse() + * \sa TriangularView::solve(), kernel(), computeKernel(), inverse(), computeInverse() */ template<typename OtherDerived, typename ResultType> bool solve(const MatrixBase<OtherDerived>& b, ResultType *result) const; @@ -380,7 +380,7 @@ void LU<MatrixType>::compute(const MatrixType& matrix) const int size = matrix.diagonalSize(); const int rows = matrix.rows(); const int cols = matrix.cols(); - + // this formula comes from experimenting (see "LU precision tuning" thread on the list) // and turns out to be identical to Higham's formula used already in LDLt. m_precision = machine_epsilon<Scalar>() * size; @@ -486,8 +486,7 @@ void LU<MatrixType>::computeKernel(KernelMatrixType *result) const y(-m_lu.corner(TopRight, m_rank, dimker)); m_lu.corner(TopLeft, m_rank, m_rank) - .template marked<UpperTriangular>() - .solveTriangularInPlace(y); + .template triangularView<UpperTriangular>().solveInPlace(y); for(int i = 0; i < m_rank; ++i) result->row(m_q.coeff(i)) = y.row(i); for(int i = m_rank; i < cols; ++i) result->row(m_q.coeff(i)).setZero(); @@ -552,9 +551,8 @@ bool LU<MatrixType>::solve( for(int i = 0; i < rows; ++i) c.row(m_p.coeff(i)) = b.row(i); // Step 2 - m_lu.corner(Eigen::TopLeft,smalldim,smalldim).template marked<UnitLowerTriangular>() - .solveTriangularInPlace( - c.corner(Eigen::TopLeft, smalldim, c.cols())); + m_lu.corner(Eigen::TopLeft,smalldim,smalldim).template triangularView<UnitLowerTriangular>() + .solveInPlace(c.corner(Eigen::TopLeft, smalldim, c.cols())); if(rows>cols) { c.corner(Eigen::BottomLeft, rows-cols, c.cols()) @@ -572,8 +570,8 @@ bool LU<MatrixType>::solve( return false; } m_lu.corner(TopLeft, m_rank, m_rank) - .template marked<UpperTriangular>() - .solveTriangularInPlace(c.corner(TopLeft, m_rank, c.cols())); + .template triangularView<UpperTriangular>() + .solveInPlace(c.corner(TopLeft, m_rank, c.cols())); // Step 4 result->resize(m_lu.cols(), b.cols()); diff --git a/Eigen/src/LU/PartialLU.h b/Eigen/src/LU/PartialLU.h index eb4b60e4f..b3a40f0e5 100644 --- a/Eigen/src/LU/PartialLU.h +++ b/Eigen/src/LU/PartialLU.h @@ -70,7 +70,7 @@ template<typename MatrixType> class PartialLU MatrixType::MaxRowsAtCompileTime) }; - /** + /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to @@ -99,7 +99,7 @@ template<typename MatrixType> class PartialLU { ei_assert(m_isInitialized && "PartialLU is not initialized."); return m_lu; - } + } /** \returns a vector of integers, whose size is the number of rows of the matrix being decomposed, * representing the P permutation i.e. the permutation of the rows. For its precise meaning, @@ -127,7 +127,7 @@ template<typename MatrixType> class PartialLU * Example: \include PartialLU_solve.cpp * Output: \verbinclude PartialLU_solve.out * - * \sa MatrixBase::solveTriangular(), inverse(), computeInverse() + * \sa TriangularView::solve(), inverse(), computeInverse() */ template<typename OtherDerived, typename ResultType> void solve(const MatrixBase<OtherDerived>& b, ResultType *result) const; @@ -235,7 +235,7 @@ void PartialLU<MatrixType>::compute(const MatrixType& matrix) * one path */ for(int col = k + 1; col < size; ++col) - m_lu.col(col).end(size-k-1) -= m_lu.col(k).end(size-k-1) * m_lu.coeff(k,col); + m_lu.col(col).end(size-k-1) -= m_lu.col(k).end(size-k-1) * m_lu.coeff(k,col); } } @@ -280,12 +280,10 @@ void PartialLU<MatrixType>::solve( for(int i = 0; i < size; ++i) result->row(m_p.coeff(i)) = b.row(i); // Step 2 - m_lu.template marked<UnitLowerTriangular>() - .solveTriangularInPlace(*result); + m_lu.template triangularView<UnitLowerTriangular>().solveInPlace(*result); // Step 3 - m_lu.template marked<UpperTriangular>() - .solveTriangularInPlace(*result); + m_lu.template triangularView<UpperTriangular>().solveInPlace(*result); } /** \lu_module diff --git a/Eigen/src/QR/HessenbergDecomposition.h b/Eigen/src/QR/HessenbergDecomposition.h index 088e00918..e7b086cb4 100644 --- a/Eigen/src/QR/HessenbergDecomposition.h +++ b/Eigen/src/QR/HessenbergDecomposition.h @@ -243,7 +243,7 @@ HessenbergDecomposition<MatrixType>::matrixH(void) const int n = m_matrix.rows(); MatrixType matH = m_matrix; if (n>2) - matH.corner(BottomLeft,n-2, n-2).template part<LowerTriangular>().setZero(); + matH.corner(BottomLeft,n-2, n-2).template triangularView<LowerTriangular>().setZero(); return matH; } diff --git a/Eigen/src/QR/QR.h b/Eigen/src/QR/QR.h index a23a3a035..ba41c0fc4 100644 --- a/Eigen/src/QR/QR.h +++ b/Eigen/src/QR/QR.h @@ -51,7 +51,7 @@ template<typename MatrixType> class HouseholderQR typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> MatrixTypeR; typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> VectorType; - /** + /** * \brief Default Constructor. * * The default constructor is useful in cases in which the user intends to @@ -66,14 +66,14 @@ template<typename MatrixType> class HouseholderQR { compute(matrix); } - + /** \returns a read-only expression of the matrix R of the actual the QR decomposition */ const TriangularView<NestByValue<MatrixRBlockType>, UpperTriangular> matrixR(void) const { ei_assert(m_isInitialized && "HouseholderQR is not initialized."); int cols = m_qr.cols(); - return MatrixRBlockType(m_qr, 0, 0, cols, cols).nestByValue().template part<UpperTriangular>(); + return MatrixRBlockType(m_qr, 0, 0, cols, cols).nestByValue().template triangularView<UpperTriangular>(); } /** This method finds a solution x to the equation Ax=b, where A is the matrix of which @@ -95,7 +95,7 @@ template<typename MatrixType> class HouseholderQR void solve(const MatrixBase<OtherDerived>& b, ResultType *result) const; MatrixType matrixQ(void) const; - + /** \returns a reference to the matrix where the Householder QR decomposition is stored * in a LAPACK-compatible way. */ @@ -113,7 +113,7 @@ template<typename MatrixType> class HouseholderQR template<typename MatrixType> void HouseholderQR<MatrixType>::compute(const MatrixType& matrix) -{ +{ m_qr = matrix; m_hCoeffs.resize(matrix.cols()); @@ -185,15 +185,15 @@ void HouseholderQR<MatrixType>::solve( const int rows = m_qr.rows(); ei_assert(b.rows() == rows); result->resize(rows, b.cols()); - + // TODO(keir): There is almost certainly a faster way to multiply by // Q^T without explicitly forming matrixQ(). Investigate. *result = matrixQ().transpose()*b; - + const int rank = std::min(result->rows(), result->cols()); m_qr.corner(TopLeft, rank, rank) - .template marked<UpperTriangular>() - .solveTriangularInPlace(result->corner(TopLeft, rank, result->cols())); + .template triangularView<UpperTriangular>() + .solveInPlace(result->corner(TopLeft, rank, result->cols())); } /** \returns the matrix Q */ diff --git a/Eigen/src/QR/Tridiagonalization.h b/Eigen/src/QR/Tridiagonalization.h index a003fd59a..d8d537ad0 100644 --- a/Eigen/src/QR/Tridiagonalization.h +++ b/Eigen/src/QR/Tridiagonalization.h @@ -173,8 +173,8 @@ Tridiagonalization<MatrixType>::matrixT(void) const matT.corner(TopRight,n-1, n-1).diagonal() = subDiagonal().template cast<Scalar>().conjugate(); if (n>2) { - matT.corner(TopRight,n-2, n-2).template part<UpperTriangular>().setZero(); - matT.corner(BottomLeft,n-2, n-2).template part<LowerTriangular>().setZero(); + matT.corner(TopRight,n-2, n-2).template triangularView<UpperTriangular>().setZero(); + matT.corner(BottomLeft,n-2, n-2).template triangularView<LowerTriangular>().setZero(); } return matT; } diff --git a/test/product_syrk.cpp b/test/product_syrk.cpp index be0606c96..657dec9bc 100644 --- a/test/product_syrk.cpp +++ b/test/product_syrk.cpp @@ -42,8 +42,7 @@ template<typename MatrixType> void syrk(const MatrixType& m) Rhs2 rhs2 = Rhs2::Random(rows, ei_random<int>(1,320)); Rhs3 rhs3 = Rhs3::Random(ei_random<int>(1,320), rows); - Scalar s1 = ei_random<Scalar>(), - s2 = ei_random<Scalar>(); + Scalar s1 = ei_random<Scalar>(); m2.setZero(); VERIFY_IS_APPROX((m2.template selfadjointView<LowerTriangular>().rankUpdate(rhs2,s1)._expression()), diff --git a/test/product_trmv.cpp b/test/product_trmv.cpp index 876fb4388..b4d45cca2 100644 --- a/test/product_trmv.cpp +++ b/test/product_trmv.cpp @@ -24,7 +24,7 @@ #include "main.h" -template<typename MatrixType> void product_triangular(const MatrixType& m) +template<typename MatrixType> void trmv(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits<Scalar>::Real RealScalar; @@ -79,14 +79,14 @@ template<typename MatrixType> void product_triangular(const MatrixType& m) // TODO check with sub-matrices } -void test_product_triangular() +void test_product_trmv() { for(int i = 0; i < g_repeat ; i++) { - CALL_SUBTEST( product_triangular(Matrix<float, 1, 1>()) ); - CALL_SUBTEST( product_triangular(Matrix<float, 2, 2>()) ); - CALL_SUBTEST( product_triangular(Matrix3d()) ); - CALL_SUBTEST( product_triangular(Matrix<std::complex<float>,23, 23>()) ); - CALL_SUBTEST( product_triangular(MatrixXcd(17,17)) ); - CALL_SUBTEST( product_triangular(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) ); + CALL_SUBTEST( trmv(Matrix<float, 1, 1>()) ); + CALL_SUBTEST( trmv(Matrix<float, 2, 2>()) ); + CALL_SUBTEST( trmv(Matrix3d()) ); + CALL_SUBTEST( trmv(Matrix<std::complex<float>,23, 23>()) ); + CALL_SUBTEST( trmv(MatrixXcd(17,17)) ); + CALL_SUBTEST( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(19, 19)) ); } } |