aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-08-15 10:55:11 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-08-15 10:55:11 +0200
commit0da31a6e1dfa06ec87b967a4124d03c3cf3a4389 (patch)
tree6c5ee1e91b9f7d282e2d1558362449a2c29fcdab
parentbff4238d154c1bbb37abd5f5df1bf04f0117e2cc (diff)
bugfix and compilation fix in ProductBase
-rw-r--r--Eigen/src/Core/ProductBase.h14
1 files 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<Derived>
{
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<typename Derived,typename Lhs,typename Rhs>
-const ScaledProduct<Derived> operator*(const ProductBase<Derived,Lhs,Rhs>& prod, typename Derived::Scalar x)
+//
+// Also note that here we accept any type which can be converted to Derived::Scalar.
+template<typename Derived,typename Lhs,typename Rhs,typename Scalar>
+const ScaledProduct<Derived> operator*(const ProductBase<Derived,Lhs,Rhs>& prod, Scalar x)
{ return ScaledProduct<Derived>(prod.derived(), x); }
-template<typename Derived,typename Lhs,typename Rhs>
-const ScaledProduct<Derived> operator*(typename Derived::Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
+template<typename Derived,typename Lhs,typename Rhs,typename Scalar>
+const ScaledProduct<Derived> operator*(Scalar x,const ProductBase<Derived,Lhs,Rhs>& prod)
{ return ScaledProduct<Derived>(prod.derived(), x); }
template<typename NestedProduct>
@@ -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<typename Dest>