diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-09-04 11:22:32 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-09-04 11:22:32 +0200 |
commit | b0aa2520f120f256c00357948149b64661e54783 (patch) | |
tree | a81cb32fdd9d9fd2104d5d06ada5192e5a59edb5 /Eigen/src/Core/CwiseUnaryOp.h | |
parent | 6902ef0824221391d159d153285f3d2142fdcd5b (diff) |
* 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
Diffstat (limited to 'Eigen/src/Core/CwiseUnaryOp.h')
-rw-r--r-- | Eigen/src/Core/CwiseUnaryOp.h | 14 |
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 |