diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-06-26 16:08:15 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-06-26 16:08:15 +0200 |
commit | 98ff17eb9e70ad62a2dad2eaee2900eb2f110720 (patch) | |
tree | 50089c9ddd7a6ee1d91ef44e4adbed33b4a28273 /Eigen/src/Core/util | |
parent | e102ddbf1fce646c3fbc0ee600cb3cce70c8b93c (diff) |
Add special path for matrix<complex>/real.
This also fixes underflow issues when scaling complex matrices through complex/complex operator.
Diffstat (limited to 'Eigen/src/Core/util')
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 1 | ||||
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index ba75d25af..7c20fed5e 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -213,6 +213,7 @@ template<typename Scalar> struct scalar_identity_op; template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_product_op; template<typename LhsScalar,typename RhsScalar> struct scalar_multiple2_op; template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_quotient_op; +template<typename LhsScalar,typename RhsScalar> struct scalar_quotient2_op; } // end namespace internal diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 2cd78576e..8c280432b 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -427,7 +427,9 @@ struct special_scalar_op_base : public DenseCoeffsBase<Derived> { // dummy operator* so that the // "using special_scalar_op_base::operator*" compiles - void operator*() const; + struct dummy {}; + void operator*(dummy) const; + void operator/(dummy) const; }; template<typename Derived,typename Scalar,typename OtherScalar> @@ -451,6 +453,16 @@ struct special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public DenseCo #endif return static_cast<const special_scalar_op_base&>(matrix).operator*(scalar); } + + const CwiseUnaryOp<scalar_quotient2_op<Scalar,OtherScalar>, Derived> + operator/(const OtherScalar& scalar) const + { +#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN + EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN +#endif + return CwiseUnaryOp<scalar_quotient2_op<Scalar,OtherScalar>, Derived> + (*static_cast<const Derived*>(this), scalar_quotient2_op<Scalar,OtherScalar>(scalar)); + } }; template<typename XprType, typename CastType> struct cast_return_type |