Main MRPT website > C++ reference
MRPT logo

ArrayCwiseBinaryOps.h

Go to the documentation of this file.
00001 /** \returns an expression of the coefficient wise product of \c *this and \a other
00002   *
00003   * \sa MatrixBase::cwiseProduct
00004   */
00005 template<typename OtherDerived>
00006 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
00007 operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00008 {
00009   return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
00010 }
00011 
00012 /** \returns an expression of the coefficient wise quotient of \c *this and \a other
00013   *
00014   * \sa MatrixBase::cwiseQuotient
00015   */
00016 template<typename OtherDerived>
00017 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>
00018 operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00019 {
00020   return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00021 }
00022 
00023 /** \returns an expression of the coefficient-wise min of \c *this and \a other
00024   *
00025   * Example: \include Cwise_min.cpp
00026   * Output: \verbinclude Cwise_min.out
00027   *
00028   * \sa max()
00029   */
00030 EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op)
00031 
00032 /** \returns an expression of the coefficient-wise max of \c *this and \a other
00033   *
00034   * Example: \include Cwise_max.cpp
00035   * Output: \verbinclude Cwise_max.out
00036   *
00037   * \sa min()
00038   */
00039 EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op)
00040 
00041 /** \returns an expression of the coefficient-wise < operator of *this and \a other
00042   *
00043   * Example: \include Cwise_less.cpp
00044   * Output: \verbinclude Cwise_less.out
00045   *
00046   * \sa all(), any(), operator>(), operator<=()
00047   */
00048 EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less)
00049 
00050 /** \returns an expression of the coefficient-wise <= operator of *this and \a other
00051   *
00052   * Example: \include Cwise_less_equal.cpp
00053   * Output: \verbinclude Cwise_less_equal.out
00054   *
00055   * \sa all(), any(), operator>=(), operator<()
00056   */
00057 EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal)
00058 
00059 /** \returns an expression of the coefficient-wise > operator of *this and \a other
00060   *
00061   * Example: \include Cwise_greater.cpp
00062   * Output: \verbinclude Cwise_greater.out
00063   *
00064   * \sa all(), any(), operator>=(), operator<()
00065   */
00066 EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater)
00067 
00068 /** \returns an expression of the coefficient-wise >= operator of *this and \a other
00069   *
00070   * Example: \include Cwise_greater_equal.cpp
00071   * Output: \verbinclude Cwise_greater_equal.out
00072   *
00073   * \sa all(), any(), operator>(), operator<=()
00074   */
00075 EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal)
00076 
00077 /** \returns an expression of the coefficient-wise == operator of *this and \a other
00078   *
00079   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
00080   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
00081   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
00082   * isMuchSmallerThan().
00083   *
00084   * Example: \include Cwise_equal_equal.cpp
00085   * Output: \verbinclude Cwise_equal_equal.out
00086   *
00087   * \sa all(), any(), isApprox(), isMuchSmallerThan()
00088   */
00089 EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to)
00090 
00091 /** \returns an expression of the coefficient-wise != operator of *this and \a other
00092   *
00093   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
00094   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
00095   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
00096   * isMuchSmallerThan().
00097   *
00098   * Example: \include Cwise_not_equal.cpp
00099   * Output: \verbinclude Cwise_not_equal.out
00100   *
00101   * \sa all(), any(), isApprox(), isMuchSmallerThan()
00102   */
00103 EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to)
00104 
00105 // scalar addition
00106 
00107 /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar
00108   *
00109   * Example: \include Cwise_plus.cpp
00110   * Output: \verbinclude Cwise_plus.out
00111   *
00112   * \sa operator+=(), operator-()
00113   */
00114 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
00115 operator+(const Scalar& scalar) const
00116 {
00117   return CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>(derived(), internal::scalar_add_op<Scalar>(scalar));
00118 }
00119 
00120 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
00121 operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
00122 {
00123   return other + scalar;
00124 }
00125 
00126 /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar
00127   *
00128   * Example: \include Cwise_minus.cpp
00129   * Output: \verbinclude Cwise_minus.out
00130   *
00131   * \sa operator+(), operator-=()
00132   */
00133 inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, Derived>
00134 operator-(const Scalar& scalar) const
00135 {
00136   return *this + (-scalar);
00137 }
00138 
00139 friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, CwiseUnaryOp<internal::scalar_opposite_op<Scalar>,Derived> >
00140 operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other)
00141 {
00142   return (-other) + scalar;
00143 }



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011