From 873401032bf91e092413cdd7b56848f7b485490a Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 17 Feb 2014 19:00:45 +0100 Subject: [PATCH] Fix scalar * product optimization when 'product' includes a selfadjoint matrix --- Eigen/src/Core/SelfAdjointView.h | 7 +++++++ Eigen/src/Core/TriangularMatrix.h | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index dd8eb25f8..2cc1815fd 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -132,6 +132,13 @@ template class SelfAdjointView { return Product(lhs.derived(),rhs); } + + friend EIGEN_DEVICE_FUNC + const SelfAdjointView,MatrixType>,UpLo> + operator*(const Scalar& s, const SelfAdjointView& mat) + { + return (s*mat.nestedExpression()).template selfadjointView(); + } #else // EIGEN_TEST_EVALUATORS diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 2b1c236b9..c5f137ab8 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -62,6 +62,14 @@ template class TriangularBase : public EigenBase inline Index outerStride() const { return derived().outerStride(); } EIGEN_DEVICE_FUNC inline Index innerStride() const { return derived().innerStride(); } + + // dummy resize function + void resize(Index nbRows, Index nbCols) + { + EIGEN_UNUSED_VARIABLE(nbRows); + EIGEN_UNUSED_VARIABLE(nbCols); + eigen_assert(nbRows==rows() && nbCols==nbCols); + } EIGEN_DEVICE_FUNC inline Scalar coeff(Index row, Index col) const { return derived().coeff(row,col); }