From a1f5ea8954bfe1818a42a5ffcc5cd40fe5878a97 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 28 Jan 2011 13:04:23 -0500 Subject: make eigen2 cholesky test pass --- Eigen/src/Core/TriangularMatrix.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'Eigen/src/Core/TriangularMatrix.h') diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 40dd2e4bc..eb82538dd 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -49,6 +49,7 @@ template class TriangularBase : public EigenBase typedef typename internal::traits::StorageKind StorageKind; typedef typename internal::traits::Index Index; typedef typename internal::traits::DenseMatrixType DenseMatrixType; + typedef DenseMatrixType DenseType; inline TriangularBase() { eigen_assert(!((Mode&UnitDiag) && (Mode&ZeroDiag))); } @@ -170,6 +171,7 @@ template class TriangularView typedef _MatrixType MatrixType; typedef typename internal::traits::DenseMatrixType DenseMatrixType; + typedef DenseMatrixType PlainObject; protected: typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; @@ -300,24 +302,24 @@ template class TriangularView (lhs.derived(),rhs.m_matrix); } - + #ifdef EIGEN2_SUPPORT - - template + template struct eigen2_product_return_type { typedef typename TriangularView::DenseMatrixType DenseMatrixType; - typedef typename TriangularView::DenseMatrixType OtherDenseMatrixType; - typedef typename ProductReturnType::Type ProdRetType; + typedef typename OtherDerived::PlainObject::DenseType OtherPlainObject; + typedef typename ProductReturnType::Type ProdRetType; typedef typename ProdRetType::PlainObject type; }; - template - const typename eigen2_product_return_type::type - operator*(const TriangularView& rhs) const + template + const typename eigen2_product_return_type::type + operator*(const EigenBase& rhs) const { - return this->toDenseMatrix() * rhs.toDenseMatrix(); + typename OtherDerived::PlainObject::DenseType rhsPlainObject; + rhs.evalTo(rhsPlainObject); + return this->toDenseMatrix() * rhsPlainObject; } - template bool isApprox(const TriangularView& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const { @@ -328,7 +330,6 @@ template class TriangularView { return this->toDenseMatrix().isApprox(other, precision); } - #endif // EIGEN2_SUPPORT template @@ -694,7 +695,7 @@ void TriangularBase::evalToLazy(MatrixBase &other) const && DenseDerived::SizeAtCompileTime * internal::traits::CoeffReadCost / 2 <= EIGEN_UNROLLING_LIMIT }; - eigen_assert(this->rows() == other.rows() && this->cols() == other.cols()); + other.derived().resize(this->rows(), this->cols()); internal::triangular_assignment_selector ::MatrixTypeNestedCleaned, Derived::Mode, -- cgit v1.2.3