From 6261f4629f7a41cff0095ab62eec0f97dd5d4cba Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 23 Aug 2010 23:38:35 +0200 Subject: [PATCH] add TriangularMatrix::conjugate to be consistent since we have adjoint --- Eigen/src/Core/TriangularMatrix.h | 12 ++++++++++++ test/triangular.cpp | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index e2afa23b0..cd1d4fd64 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -154,11 +154,17 @@ template class TriangularView typedef TriangularBase Base; typedef typename ei_traits::Scalar Scalar; + + protected: typedef _MatrixType MatrixType; typedef typename MatrixType::PlainObject DenseMatrixType; typedef typename MatrixType::Nested MatrixTypeNested; typedef typename ei_cleantype::type _MatrixTypeNested; + typedef typename ei_cleantype::type MatrixConjugateReturnType; + + public: using Base::evalToLazy; + typedef typename ei_traits::StorageKind StorageKind; typedef typename ei_traits::Index Index; @@ -235,6 +241,12 @@ template class TriangularView template void lazyAssign(const MatrixBase& other); + /** \sa MatrixBase::conjugate() */ + inline TriangularView conjugate() + { return m_matrix.conjugate(); } + /** \sa MatrixBase::conjugate() const */ + inline const TriangularView conjugate() const + { return m_matrix.conjugate(); } /** \sa MatrixBase::adjoint() */ inline TriangularView adjoint() diff --git a/test/triangular.cpp b/test/triangular.cpp index 3436f18eb..bf5db4e27 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -83,6 +83,9 @@ template void triangular_square(const MatrixType& m) m1.template triangularView() = m2.transpose() + m2; VERIFY_IS_APPROX(m3.template triangularView().toDenseMatrix(), m1); + VERIFY_IS_APPROX(m3.template triangularView().conjugate().toDenseMatrix(), + m3.conjugate().template triangularView().toDenseMatrix()); + m1 = MatrixType::Random(rows, cols); for (int i=0; i();