From b0aa2520f120f256c00357948149b64661e54783 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 4 Sep 2009 11:22:32 +0200 Subject: * add real scalar * complex matrix, real matrix * complex scalar, and complex scalar * real matrix overloads * allows the inner and outer product specialisations to mix real and complex --- Eigen/src/Core/CwiseUnaryOp.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Eigen/src/Core/CwiseUnaryOp.h') 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::log() const } -/** \relates MatrixBase */ +/** \returns an expression of \c *this scaled by the scalar factor \a scalar */ template EIGEN_STRONG_INLINE const typename MatrixBase::ScalarMultipleReturnType MatrixBase::operator*(const Scalar& scalar) const @@ -241,7 +241,17 @@ MatrixBase::operator*(const Scalar& scalar) const (derived(), ei_scalar_multiple_op(scalar)); } -/** \relates MatrixBase */ +/** Overloaded for efficient real matrix times complex scalar value */ +template +EIGEN_STRONG_INLINE const CwiseUnaryOp::Scalar, + std::complex::Scalar> >, Derived> +MatrixBase::operator*(const std::complex& scalar) const +{ + return CwiseUnaryOp >, Derived> + (*static_cast(this), ei_scalar_multiple2_op >(scalar)); +} + +/** \returns an expression of \c *this divided by the scalar value \a scalar */ template EIGEN_STRONG_INLINE const CwiseUnaryOp::Scalar>, Derived> MatrixBase::operator/(const Scalar& scalar) const -- cgit v1.2.3