aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/CwiseUnaryOp.h
diff options
context:
space:
mode:
Diffstat (limited to 'Eigen/src/Core/CwiseUnaryOp.h')
-rw-r--r--Eigen/src/Core/CwiseUnaryOp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h
index 6e4c0d4ec..03011800c 100644
--- a/Eigen/src/Core/CwiseUnaryOp.h
+++ b/Eigen/src/Core/CwiseUnaryOp.h
@@ -232,7 +232,7 @@ Cwise<ExpressionType>::log() const
}
-/** \relates MatrixBase */
+/** \returns an expression of \c *this scaled by the scalar factor \a scalar */
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::ScalarMultipleReturnType
MatrixBase<Derived>::operator*(const Scalar& scalar) const
@@ -241,7 +241,17 @@ MatrixBase<Derived>::operator*(const Scalar& scalar) const
(derived(), ei_scalar_multiple_op<Scalar>(scalar));
}
-/** \relates MatrixBase */
+/** Overloaded for efficient real matrix times complex scalar value */
+template<typename Derived>
+EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_multiple2_op<typename ei_traits<Derived>::Scalar,
+ std::complex<typename ei_traits<Derived>::Scalar> >, Derived>
+MatrixBase<Derived>::operator*(const std::complex<Scalar>& scalar) const
+{
+ return CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived>
+ (*static_cast<const Derived*>(this), ei_scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
+}
+
+/** \returns an expression of \c *this divided by the scalar value \a scalar */
template<typename Derived>
EIGEN_STRONG_INLINE const CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>, Derived>
MatrixBase<Derived>::operator/(const Scalar& scalar) const