From a226f6af6b7d78db63064b64754e8d05789db54a Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 19 May 2016 13:05:33 +0200 Subject: Add support for SelfAdjointView::diagonal() --- Eigen/src/Core/SelfAdjointView.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Eigen/src/Core/SelfAdjointView.h') diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index d08350df1..92c541f08 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -55,6 +55,7 @@ template class SelfAdjointView typedef TriangularBase Base; typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; typedef typename internal::traits::MatrixTypeNestedCleaned MatrixTypeNestedCleaned; + typedef MatrixTypeNestedCleaned NestedExpression; /** \brief The type of coefficients in this matrix */ typedef typename internal::traits::Scalar Scalar; @@ -183,7 +184,18 @@ template class SelfAdjointView typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::AdjointReturnType>::type tmp2(tmp1); return typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), TriangularView, - TriangularView,TriMode> >::type(tmp); + TriangularView >::type(tmp2); + } + + /** \returns a const expression of the main diagonal of the matrix \c *this + * + * This method simply returns the diagonal of the nested expression, thus by-passing the SelfAdjointView decorator. + * + * \sa MatrixBase::diagonal(), class Diagonal */ + EIGEN_DEVICE_FUNC + typename MatrixType::ConstDiagonalReturnType diagonal() const + { + return typename MatrixType::ConstDiagonalReturnType(m_matrix); } /////////// Cholesky module /////////// -- cgit v1.2.3