aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-09-02 14:41:14 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-09-02 14:41:14 +0200
commit3eb5253ca1352391f4ea31c4a2dd06c34c4a33e7 (patch)
tree841bbcfca8d5e802635d1c04cd78c84807290d58 /Eigen/src/Core
parent305aa1f9c570db60a92e49020f21e70311bbed36 (diff)
Optimization: "matrix<complex> * real" did not call the special path and the real was converted to a complex. Add respective unit test to avoid future regression.
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r--Eigen/src/Core/MatrixBase.h1
-rw-r--r--Eigen/src/Core/util/XprHelper.h10
2 files changed, 10 insertions, 1 deletions
diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h
index f5987d194..3cb5e04fd 100644
--- a/Eigen/src/Core/MatrixBase.h
+++ b/Eigen/src/Core/MatrixBase.h
@@ -81,6 +81,7 @@ template<typename Derived> class MatrixBase
using Base::operator-=;
using Base::operator*=;
using Base::operator/=;
+ using Base::operator*;
typedef typename Base::CoeffReturnType CoeffReturnType;
typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType;
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index 1b3e122e1..7c77b2263 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -383,13 +383,21 @@ struct special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public DenseCo
const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
operator*(const OtherScalar& scalar) const
{
+#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
+ EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
+#endif
return CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
(*static_cast<const Derived*>(this), scalar_multiple2_op<Scalar,OtherScalar>(scalar));
}
inline friend const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
operator*(const OtherScalar& scalar, const Derived& matrix)
- { return static_cast<const special_scalar_op_base&>(matrix).operator*(scalar); }
+ {
+#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
+ EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
+#endif
+ return static_cast<const special_scalar_op_base&>(matrix).operator*(scalar);
+ }
};
template<typename XprType, typename CastType> struct cast_return_type