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
00039 template<typename ExpressionType>
00040 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sqrt_op)
00041 Cwise<ExpressionType>::sqrt() const
00042 {
00043 return _expression();
00044 }
00045
00055 template<typename ExpressionType>
00056 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_exp_op)
00057 Cwise<ExpressionType>::exp() const
00058 {
00059 return _expression();
00060 }
00061
00071 template<typename ExpressionType>
00072 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_log_op)
00073 Cwise<ExpressionType>::log() const
00074 {
00075 return _expression();
00076 }
00077
00087 template<typename ExpressionType>
00088 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cos_op)
00089 Cwise<ExpressionType>::cos() const
00090 {
00091 return _expression();
00092 }
00093
00094
00104 template<typename ExpressionType>
00105 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_sin_op)
00106 Cwise<ExpressionType>::sin() const
00107 {
00108 return _expression();
00109 }
00110
00111
00121 template<typename ExpressionType>
00122 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op)
00123 Cwise<ExpressionType>::pow(const Scalar& exponent) const
00124 {
00125 return EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_pow_op)(_expression(), ei_scalar_pow_op<Scalar>(exponent));
00126 }
00127
00128
00138 template<typename ExpressionType>
00139 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_inverse_op)
00140 Cwise<ExpressionType>::inverse() const
00141 {
00142 return _expression();
00143 }
00144
00154 template<typename ExpressionType>
00155 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_square_op)
00156 Cwise<ExpressionType>::square() const
00157 {
00158 return _expression();
00159 }
00160
00170 template<typename ExpressionType>
00171 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(ei_scalar_cube_op)
00172 Cwise<ExpressionType>::cube() const
00173 {
00174 return _expression();
00175 }
00176
00177
00178
00179
00189 template<typename ExpressionType>
00190 template<typename OtherDerived>
00191 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
00192 Cwise<ExpressionType>::operator<(const MatrixBase<OtherDerived> &other) const
00193 {
00194 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)(_expression(), other.derived());
00195 }
00196
00206 template<typename ExpressionType>
00207 template<typename OtherDerived>
00208 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)
00209 Cwise<ExpressionType>::operator<=(const MatrixBase<OtherDerived> &other) const
00210 {
00211 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)(_expression(), other.derived());
00212 }
00213
00223 template<typename ExpressionType>
00224 template<typename OtherDerived>
00225 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)
00226 Cwise<ExpressionType>::operator>(const MatrixBase<OtherDerived> &other) const
00227 {
00228 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)(_expression(), other.derived());
00229 }
00230
00240 template<typename ExpressionType>
00241 template<typename OtherDerived>
00242 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)
00243 Cwise<ExpressionType>::operator>=(const MatrixBase<OtherDerived> &other) const
00244 {
00245 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)(_expression(), other.derived());
00246 }
00247
00262 template<typename ExpressionType>
00263 template<typename OtherDerived>
00264 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)
00265 Cwise<ExpressionType>::operator==(const MatrixBase<OtherDerived> &other) const
00266 {
00267 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)(_expression(), other.derived());
00268 }
00269
00284 template<typename ExpressionType>
00285 template<typename OtherDerived>
00286 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)
00287 Cwise<ExpressionType>::operator!=(const MatrixBase<OtherDerived> &other) const
00288 {
00289 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)(_expression(), other.derived());
00290 }
00291
00292
00293
00300 template<typename ExpressionType>
00301 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)
00302 Cwise<ExpressionType>::operator<(Scalar s) const
00303 {
00304 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)(_expression(),
00305 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00306 }
00307
00314 template<typename ExpressionType>
00315 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)
00316 Cwise<ExpressionType>::operator<=(Scalar s) const
00317 {
00318 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)(_expression(),
00319 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00320 }
00321
00328 template<typename ExpressionType>
00329 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)
00330 Cwise<ExpressionType>::operator>(Scalar s) const
00331 {
00332 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)(_expression(),
00333 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00334 }
00335
00342 template<typename ExpressionType>
00343 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)
00344 Cwise<ExpressionType>::operator>=(Scalar s) const
00345 {
00346 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)(_expression(),
00347 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00348 }
00349
00361 template<typename ExpressionType>
00362 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)
00363 Cwise<ExpressionType>::operator==(Scalar s) const
00364 {
00365 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)(_expression(),
00366 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00367 }
00368
00380 template<typename ExpressionType>
00381 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)
00382 Cwise<ExpressionType>::operator!=(Scalar s) const
00383 {
00384 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)(_expression(),
00385 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00386 }
00387
00388
00389
00399 template<typename ExpressionType>
00400 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00401 Cwise<ExpressionType>::operator+(const Scalar& scalar) const
00402 {
00403 return typename Cwise<ExpressionType>::ScalarAddReturnType(m_matrix, ei_scalar_add_op<Scalar>(scalar));
00404 }
00405
00415 template<typename ExpressionType>
00416 inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar)
00417 {
00418 return m_matrix.const_cast_derived() = *this + scalar;
00419 }
00420
00430 template<typename ExpressionType>
00431 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00432 Cwise<ExpressionType>::operator-(const Scalar& scalar) const
00433 {
00434 return *this + (-scalar);
00435 }
00436
00447 template<typename ExpressionType>
00448 inline ExpressionType& Cwise<ExpressionType>::operator-=(const Scalar& scalar)
00449 {
00450 return m_matrix.const_cast_derived() = *this - scalar;
00451 }
00452
00453 #endif // EIGEN_ARRAY_CWISE_OPERATORS_H