CommonCwiseUnaryOps.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 // This file is a base class plugin containing common coefficient wise functions.
00012 
00013 #ifndef EIGEN_PARSED_BY_DOXYGEN
00014 
00016 typedef CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const Derived> ScalarMultipleReturnType;
00018 typedef CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const Derived> ScalarQuotient1ReturnType;
00020 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
00021                     const CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const Derived>,
00022                     const Derived&
00023                   >::type ConjugateReturnType;
00025 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
00026                     const CwiseUnaryOp<internal::scalar_real_op<Scalar>, const Derived>,
00027                     const Derived&
00028                   >::type RealReturnType;
00030 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
00031                     CwiseUnaryView<internal::scalar_real_ref_op<Scalar>, Derived>,
00032                     Derived&
00033                   >::type NonConstRealReturnType;
00035 typedef CwiseUnaryOp<internal::scalar_imag_op<Scalar>, const Derived> ImagReturnType;
00037 typedef CwiseUnaryView<internal::scalar_imag_ref_op<Scalar>, Derived> NonConstImagReturnType;
00038 
00039 #endif // not EIGEN_PARSED_BY_DOXYGEN
00040 
00043 inline const CwiseUnaryOp<internal::scalar_opposite_op<typename internal::traits<Derived>::Scalar>, const Derived>
00044 operator-() const { return derived(); }
00045 
00046 
00048 inline const ScalarMultipleReturnType
00049 operator*(const Scalar& scalar) const
00050 {
00051   return CwiseUnaryOp<internal::scalar_multiple_op<Scalar>, const Derived>
00052     (derived(), internal::scalar_multiple_op<Scalar>(scalar));
00053 }
00054 
00055 #ifdef EIGEN_PARSED_BY_DOXYGEN
00056 const ScalarMultipleReturnType operator*(const RealScalar& scalar) const;
00057 #endif
00058 
00060 inline const CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, const Derived>
00061 operator/(const Scalar& scalar) const
00062 {
00063   return CwiseUnaryOp<internal::scalar_quotient1_op<Scalar>, const Derived>
00064     (derived(), internal::scalar_quotient1_op<Scalar>(scalar));
00065 }
00066 
00068 inline const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived>
00069 operator*(const std::complex<Scalar>& scalar) const
00070 {
00071   return CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived>
00072     (*static_cast<const Derived*>(this), internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >(scalar));
00073 }
00074 
00075 inline friend const ScalarMultipleReturnType
00076 operator*(const Scalar& scalar, const StorageBaseType& matrix)
00077 { return matrix*scalar; }
00078 
00079 inline friend const CwiseUnaryOp<internal::scalar_multiple2_op<Scalar,std::complex<Scalar> >, const Derived>
00080 operator*(const std::complex<Scalar>& scalar, const StorageBaseType& matrix)
00081 { return matrix*scalar; }
00082 
00090 template<typename NewType>
00091 typename internal::cast_return_type<Derived,const CwiseUnaryOp<internal::scalar_cast_op<typename internal::traits<Derived>::Scalar, NewType>, const Derived> >::type
00092 cast() const
00093 {
00094   return derived();
00095 }
00096 
00100 inline ConjugateReturnType
00101 conjugate() const
00102 {
00103   return ConjugateReturnType(derived());
00104 }
00105 
00109 inline RealReturnType
00110 real() const { return derived(); }
00111 
00115 inline const ImagReturnType
00116 imag() const { return derived(); }
00117 
00137 template<typename CustomUnaryOp>
00138 inline const CwiseUnaryOp<CustomUnaryOp, const Derived>
00139 unaryExpr(const CustomUnaryOp& func = CustomUnaryOp()) const
00140 {
00141   return CwiseUnaryOp<CustomUnaryOp, const Derived>(derived(), func);
00142 }
00143 
00155 template<typename CustomViewOp>
00156 inline const CwiseUnaryView<CustomViewOp, const Derived>
00157 unaryViewExpr(const CustomViewOp& func = CustomViewOp()) const
00158 {
00159   return CwiseUnaryView<CustomViewOp, const Derived>(derived(), func);
00160 }
00161 
00165 inline NonConstRealReturnType
00166 real() { return derived(); }
00167 
00171 inline NonConstImagReturnType
00172 imag() { return derived(); }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:00