From 0da31a6e1dfa06ec87b967a4124d03c3cf3a4389 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 15 Aug 2009 10:55:11 +0200 Subject: bugfix and compilation fix in ProductBase --- Eigen/src/Core/ProductBase.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Core/ProductBase.h b/Eigen/src/Core/ProductBase.h index 0da046b1e..2090a0e49 100644 --- a/Eigen/src/Core/ProductBase.h +++ b/Eigen/src/Core/ProductBase.h @@ -115,7 +115,7 @@ class ProductBase : public MatrixBase { PlainMatrixType res(rows(), cols()); res.setZero(); - evalTo(res); + derived().evalTo(res); return res; } @@ -148,12 +148,14 @@ class ScaledProduct; // functions of ProductBase, because, otherwise we would have to // define all overloads defined in MatrixBase. Furthermore, Using // "using Base::operator*" would not work with MSVC. -template -const ScaledProduct operator*(const ProductBase& prod, typename Derived::Scalar x) +// +// Also note that here we accept any type which can be converted to Derived::Scalar. +template +const ScaledProduct operator*(const ProductBase& prod, Scalar x) { return ScaledProduct(prod.derived(), x); } -template -const ScaledProduct operator*(typename Derived::Scalar x,const ProductBase& prod) +template +const ScaledProduct operator*(Scalar x,const ProductBase& prod) { return ScaledProduct(prod.derived(), x); } template @@ -176,7 +178,7 @@ class ScaledProduct typedef typename Base::Scalar Scalar; // EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) - ScaledProduct(const NestedProduct& prod, Scalar& x) + ScaledProduct(const NestedProduct& prod, Scalar x) : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} template -- cgit v1.2.3