diff options
Diffstat (limited to 'Eigen/src/plugins/CommonCwiseUnaryOps.h')
-rw-r--r-- | Eigen/src/plugins/CommonCwiseUnaryOps.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Eigen/src/plugins/CommonCwiseUnaryOps.h b/Eigen/src/plugins/CommonCwiseUnaryOps.h index 631d6197b..941d5153c 100644 --- a/Eigen/src/plugins/CommonCwiseUnaryOps.h +++ b/Eigen/src/plugins/CommonCwiseUnaryOps.h @@ -28,17 +28,17 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal Represents a scalar multiple of an expression */ -typedef CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, Derived> ScalarMultipleReturnType; +typedef CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const Derived> ScalarMultipleReturnType; /** \internal Represents a quotient of an expression by a scalar*/ -typedef CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, Derived> ScalarQuotient1ReturnType; +typedef CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const Derived> ScalarQuotient1ReturnType; /** \internal the return type of conjugate() */ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, - const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, Derived>, + const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Derived>, const Derived& >::type ConjugateReturnType; /** \internal the return type of real() const */ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, - const CwiseUnaryOp<internal::scalar_real_op<Scalar>, Derived>, + const CwiseUnaryOp<internal::scalar_real_op<Scalar>, const Derived>, const Derived& >::type RealReturnType; /** \internal the return type of real() */ @@ -47,7 +47,7 @@ typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, Derived& >::type NonConstRealReturnType; /** \internal the return type of imag() const */ -typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, Derived> ImagReturnType; +typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, const Derived> ImagReturnType; /** \internal the return type of imag() */ typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstImagReturnType; @@ -55,7 +55,7 @@ typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstIm /** \returns an expression of the opposite of \c *this */ -inline const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>,Derived> +inline const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>, const Derived> operator-() const { return derived(); } @@ -63,7 +63,7 @@ operator-() const { return derived(); } inline const ScalarMultipleReturnType operator*(const Scalar& scalar) const { - return CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, Derived> + return CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const Derived> (derived(), internal::scalar_multiple_op<Scalar>(scalar)); } @@ -72,18 +72,18 @@ const ScalarMultipleReturnType operator*(const RealScalar& scalar) const; #endif /** \returns an expression of \c *this divided by the scalar value \a scalar */ -inline const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, Derived> +inline const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, const Derived> operator/(const Scalar& scalar) const { - return CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, Derived> + return CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const Derived> (derived(), internal::scalar_quotient1_op<Scalar>(scalar)); } /** Overloaded for efficient real matrix times complex scalar value */ -inline const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived> +inline const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived> operator*(const std::complex<Scalar>& scalar) const { - return CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived> + return CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived> (*static_cast<const Derived*>(this), internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar)); } @@ -91,7 +91,7 @@ inline friend const ScalarMultipleReturnType operator*(const Scalar& scalar, const StorageBaseType& matrix) { return matrix*scalar; } -inline friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, Derived> +inline friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived> operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix) { return matrix*scalar; } @@ -103,7 +103,7 @@ operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix) * \sa class CwiseUnaryOp */ template<typename NewType> -typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, Derived> >::type +typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, const Derived> >::type cast() const { return derived(); @@ -150,10 +150,10 @@ imag() const { return derived(); } * \sa class CwiseUnaryOp, class CwiseBinaryOp */ template<typename CustomUnaryOp> -inline const CwiseUnaryOp<CustomUnaryOp, Derived> +inline const CwiseUnaryOp<CustomUnaryOp, const Derived> unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const { - return CwiseUnaryOp<CustomUnaryOp, Derived>(derived(), func); + return CwiseUnaryOp<CustomUnaryOp, const Derived>(derived(), func); } /** \returns an expression of a custom coefficient-wise unary operator \a func of *this @@ -168,10 +168,10 @@ unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const * \sa class CwiseUnaryOp, class CwiseBinaryOp */ template<typename CustomViewOp> -inline const CwiseUnaryView<CustomViewOp, Derived> +inline const CwiseUnaryView<CustomViewOp, const Derived> unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const { - return CwiseUnaryView<CustomViewOp, Derived>(derived(), func); + return CwiseUnaryView<CustomViewOp, const Derived>(derived(), func); } /** \returns a non const expression of the real part of \c *this. |