Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_ARRAY_CWISE_OPERATORS_H
00026 #define EIGEN_ARRAY_CWISE_OPERATORS_H
00027
00028
00029
00030
00031
00032
00034 template<typename ExpressionType>
00035 EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs_op)
00036 Cwise<ExpressionType>::abs() const
00037 {
00038 return _expression();
00039 }
00040
00042 template<typename ExpressionType>
00043 EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs2_op)
00044 Cwise<ExpressionType>::abs2() const
00045 {
00046 return _expression();
00047 }
00048
00050 template<typename ExpressionType>
00051 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_exp_op)
00052 Cwise<ExpressionType>::exp() const
00053 {
00054 return _expression();
00055 }
00056
00058 template<typename ExpressionType>
00059 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_log_op)
00060 Cwise<ExpressionType>::log() const
00061 {
00062 return _expression();
00063 }
00064
00066 template<typename ExpressionType>
00067 template<typename OtherDerived>
00068 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(ExpressionType,OtherDerived)
00069 Cwise<ExpressionType>::operator*(const MatrixBase<OtherDerived> &other) const
00070 {
00071 return EIGEN_CWISE_PRODUCT_RETURN_TYPE(ExpressionType,OtherDerived)(_expression(), other.derived());
00072 }
00073
00075 template<typename ExpressionType>
00076 template<typename OtherDerived>
00077 EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)
00078 Cwise<ExpressionType>::operator/(const MatrixBase<OtherDerived> &other) const
00079 {
00080 return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
00081 }
00082
00084 template<typename ExpressionType>
00085 template<typename OtherDerived>
00086 inline ExpressionType& Cwise<ExpressionType>::operator*=(const MatrixBase<OtherDerived> &other)
00087 {
00088 return m_matrix.const_cast_derived() = *this * other;
00089 }
00090
00092 template<typename ExpressionType>
00093 template<typename OtherDerived>
00094 inline ExpressionType& Cwise<ExpressionType>::operator/=(const MatrixBase<OtherDerived> &other)
00095 {
00096 return m_matrix.const_cast_derived() = *this / other;
00097 }
00098
00099
00100
00101
00102
00103
00104
00106 template<typename ExpressionType>
00107 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sqrt_op)
00108 Cwise<ExpressionType>::sqrt() const
00109 {
00110 return _expression();
00111 }
00112
00114 template<typename ExpressionType>
00115 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cos_op)
00116 Cwise<ExpressionType>::cos() const
00117 {
00118 return _expression();
00119 }
00120
00121
00123 template<typename ExpressionType>
00124 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sin_op)
00125 Cwise<ExpressionType>::sin() const
00126 {
00127 return _expression();
00128 }
00129
00130
00132 template<typename ExpressionType>
00133 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)
00134 Cwise<ExpressionType>::pow(const Scalar& exponent) const
00135 {
00136 return EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)(_expression(), internal::scalar_pow_op<Scalar>(exponent));
00137 }
00138
00139
00141 template<typename ExpressionType>
00142 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_inverse_op)
00143 Cwise<ExpressionType>::inverse() const
00144 {
00145 return _expression();
00146 }
00147
00149 template<typename ExpressionType>
00150 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_square_op)
00151 Cwise<ExpressionType>::square() const
00152 {
00153 return _expression();
00154 }
00155
00157 template<typename ExpressionType>
00158 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cube_op)
00159 Cwise<ExpressionType>::cube() const
00160 {
00161 return _expression();
00162 }
00163
00164
00165
00166
00168 template<typename ExpressionType>
00169 template<typename OtherDerived>
00170 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
00171 Cwise<ExpressionType>::operator<(const MatrixBase<OtherDerived> &other) const
00172 {
00173 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)(_expression(), other.derived());
00174 }
00175
00177 template<typename ExpressionType>
00178 template<typename OtherDerived>
00179 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)
00180 Cwise<ExpressionType>::operator<=(const MatrixBase<OtherDerived> &other) const
00181 {
00182 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)(_expression(), other.derived());
00183 }
00184
00186 template<typename ExpressionType>
00187 template<typename OtherDerived>
00188 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)
00189 Cwise<ExpressionType>::operator>(const MatrixBase<OtherDerived> &other) const
00190 {
00191 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)(_expression(), other.derived());
00192 }
00193
00195 template<typename ExpressionType>
00196 template<typename OtherDerived>
00197 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)
00198 Cwise<ExpressionType>::operator>=(const MatrixBase<OtherDerived> &other) const
00199 {
00200 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)(_expression(), other.derived());
00201 }
00202
00204 template<typename ExpressionType>
00205 template<typename OtherDerived>
00206 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)
00207 Cwise<ExpressionType>::operator==(const MatrixBase<OtherDerived> &other) const
00208 {
00209 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)(_expression(), other.derived());
00210 }
00211
00213 template<typename ExpressionType>
00214 template<typename OtherDerived>
00215 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)
00216 Cwise<ExpressionType>::operator!=(const MatrixBase<OtherDerived> &other) const
00217 {
00218 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)(_expression(), other.derived());
00219 }
00220
00221
00222
00224 template<typename ExpressionType>
00225 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)
00226 Cwise<ExpressionType>::operator<(Scalar s) const
00227 {
00228 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)(_expression(),
00229 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00230 }
00231
00233 template<typename ExpressionType>
00234 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)
00235 Cwise<ExpressionType>::operator<=(Scalar s) const
00236 {
00237 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)(_expression(),
00238 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00239 }
00240
00242 template<typename ExpressionType>
00243 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)
00244 Cwise<ExpressionType>::operator>(Scalar s) const
00245 {
00246 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)(_expression(),
00247 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00248 }
00249
00251 template<typename ExpressionType>
00252 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)
00253 Cwise<ExpressionType>::operator>=(Scalar s) const
00254 {
00255 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)(_expression(),
00256 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00257 }
00258
00260 template<typename ExpressionType>
00261 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)
00262 Cwise<ExpressionType>::operator==(Scalar s) const
00263 {
00264 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)(_expression(),
00265 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00266 }
00267
00269 template<typename ExpressionType>
00270 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)
00271 Cwise<ExpressionType>::operator!=(Scalar s) const
00272 {
00273 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)(_expression(),
00274 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00275 }
00276
00277
00278
00280 template<typename ExpressionType>
00281 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00282 Cwise<ExpressionType>::operator+(const Scalar& scalar) const
00283 {
00284 return typename Cwise<ExpressionType>::ScalarAddReturnType(m_matrix, internal::scalar_add_op<Scalar>(scalar));
00285 }
00286
00288 template<typename ExpressionType>
00289 inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar)
00290 {
00291 return m_matrix.const_cast_derived() = *this + scalar;
00292 }
00293
00295 template<typename ExpressionType>
00296 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00297 Cwise<ExpressionType>::operator-(const Scalar& scalar) const
00298 {
00299 return *this + (-scalar);
00300 }
00301
00303 template<typename ExpressionType>
00304 inline ExpressionType& Cwise<ExpressionType>::operator-=(const Scalar& scalar)
00305 {
00306 return m_matrix.const_cast_derived() = *this - scalar;
00307 }
00308
00309 #endif // EIGEN_ARRAY_CWISE_OPERATORS_H