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
00100 template<typename ExpressionType>
00101 template<typename OtherDerived>
00102 EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)
00103 Cwise<ExpressionType>::min(const MatrixBase<OtherDerived> &other) const
00104 {
00105 return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_min_op)(_expression(), other.derived());
00106 }
00107
00109 template<typename ExpressionType>
00110 template<typename OtherDerived>
00111 EIGEN_STRONG_INLINE const EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)
00112 Cwise<ExpressionType>::max(const MatrixBase<OtherDerived> &other) const
00113 {
00114 return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_max_op)(_expression(), other.derived());
00115 }
00116
00117
00118
00119
00120
00121
00122
00124 template<typename ExpressionType>
00125 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sqrt_op)
00126 Cwise<ExpressionType>::sqrt() const
00127 {
00128 return _expression();
00129 }
00130
00132 template<typename ExpressionType>
00133 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cos_op)
00134 Cwise<ExpressionType>::cos() const
00135 {
00136 return _expression();
00137 }
00138
00139
00141 template<typename ExpressionType>
00142 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_sin_op)
00143 Cwise<ExpressionType>::sin() const
00144 {
00145 return _expression();
00146 }
00147
00148
00150 template<typename ExpressionType>
00151 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)
00152 Cwise<ExpressionType>::pow(const Scalar& exponent) const
00153 {
00154 return EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_pow_op)(_expression(), internal::scalar_pow_op<Scalar>(exponent));
00155 }
00156
00157
00159 template<typename ExpressionType>
00160 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_inverse_op)
00161 Cwise<ExpressionType>::inverse() const
00162 {
00163 return _expression();
00164 }
00165
00167 template<typename ExpressionType>
00168 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_square_op)
00169 Cwise<ExpressionType>::square() const
00170 {
00171 return _expression();
00172 }
00173
00175 template<typename ExpressionType>
00176 inline const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_cube_op)
00177 Cwise<ExpressionType>::cube() const
00178 {
00179 return _expression();
00180 }
00181
00182
00183
00184
00186 template<typename ExpressionType>
00187 template<typename OtherDerived>
00188 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
00189 Cwise<ExpressionType>::operator<(const MatrixBase<OtherDerived> &other) const
00190 {
00191 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)(_expression(), other.derived());
00192 }
00193
00195 template<typename ExpressionType>
00196 template<typename OtherDerived>
00197 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)
00198 Cwise<ExpressionType>::operator<=(const MatrixBase<OtherDerived> &other) const
00199 {
00200 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)(_expression(), other.derived());
00201 }
00202
00204 template<typename ExpressionType>
00205 template<typename OtherDerived>
00206 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)
00207 Cwise<ExpressionType>::operator>(const MatrixBase<OtherDerived> &other) const
00208 {
00209 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)(_expression(), other.derived());
00210 }
00211
00213 template<typename ExpressionType>
00214 template<typename OtherDerived>
00215 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)
00216 Cwise<ExpressionType>::operator>=(const MatrixBase<OtherDerived> &other) const
00217 {
00218 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)(_expression(), other.derived());
00219 }
00220
00222 template<typename ExpressionType>
00223 template<typename OtherDerived>
00224 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)
00225 Cwise<ExpressionType>::operator==(const MatrixBase<OtherDerived> &other) const
00226 {
00227 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)(_expression(), other.derived());
00228 }
00229
00231 template<typename ExpressionType>
00232 template<typename OtherDerived>
00233 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)
00234 Cwise<ExpressionType>::operator!=(const MatrixBase<OtherDerived> &other) const
00235 {
00236 return EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)(_expression(), other.derived());
00237 }
00238
00239
00240
00242 template<typename ExpressionType>
00243 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)
00244 Cwise<ExpressionType>::operator<(Scalar s) const
00245 {
00246 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)(_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::less_equal)
00253 Cwise<ExpressionType>::operator<=(Scalar s) const
00254 {
00255 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_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::greater)
00262 Cwise<ExpressionType>::operator>(Scalar s) const
00263 {
00264 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)(_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::greater_equal)
00271 Cwise<ExpressionType>::operator>=(Scalar s) const
00272 {
00273 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)(_expression(),
00274 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00275 }
00276
00278 template<typename ExpressionType>
00279 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)
00280 Cwise<ExpressionType>::operator==(Scalar s) const
00281 {
00282 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)(_expression(),
00283 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00284 }
00285
00287 template<typename ExpressionType>
00288 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)
00289 Cwise<ExpressionType>::operator!=(Scalar s) const
00290 {
00291 return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)(_expression(),
00292 typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
00293 }
00294
00295
00296
00298 template<typename ExpressionType>
00299 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00300 Cwise<ExpressionType>::operator+(const Scalar& scalar) const
00301 {
00302 return typename Cwise<ExpressionType>::ScalarAddReturnType(m_matrix, internal::scalar_add_op<Scalar>(scalar));
00303 }
00304
00306 template<typename ExpressionType>
00307 inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar)
00308 {
00309 return m_matrix.const_cast_derived() = *this + scalar;
00310 }
00311
00313 template<typename ExpressionType>
00314 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
00315 Cwise<ExpressionType>::operator-(const Scalar& scalar) const
00316 {
00317 return *this + (-scalar);
00318 }
00319
00321 template<typename ExpressionType>
00322 inline ExpressionType& Cwise<ExpressionType>::operator-=(const Scalar& scalar)
00323 {
00324 return m_matrix.const_cast_derived() = *this - scalar;
00325 }
00326
00327 #endif // EIGEN_ARRAY_CWISE_OPERATORS_H