Main MRPT website > C++ reference
MRPT logo

MatrixCwiseBinaryOps.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 // Eigen is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 3 of the License, or (at your option) any later version.
00011 //
00012 // Alternatively, you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License as
00014 // published by the Free Software Foundation; either version 2 of
00015 // the License, or (at your option) any later version.
00016 //
00017 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License and a copy of the GNU General Public License along with
00024 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00025 
00026 // This file is a base class plugin containing matrix specifics coefficient wise functions.
00027 
00028 /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other
00029   *
00030   * Example: \include MatrixBase_cwiseProduct.cpp
00031   * Output: \verbinclude MatrixBase_cwiseProduct.out
00032   *
00033   * \sa class CwiseBinaryOp, cwiseAbs2
00034   */
00035 template<typename OtherDerived>
00036 EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)
00037 cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00038 {
00039   return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived());
00040 }
00041 
00042 /** \returns an expression of the coefficient-wise == operator of *this and \a other
00043   *
00044   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
00045   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
00046   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
00047   * isMuchSmallerThan().
00048   *
00049   * Example: \include MatrixBase_cwiseEqual.cpp
00050   * Output: \verbinclude MatrixBase_cwiseEqual.out
00051   *
00052   * \sa cwiseNotEqual(), isApprox(), isMuchSmallerThan()
00053   */
00054 template<typename OtherDerived>
00055 inline const CwiseBinaryOp<std::equal_to<Scalar>, Derived, OtherDerived>
00056 cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00057 {
00058   return CwiseBinaryOp<std::equal_to<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00059 }
00060 
00061 /** \returns an expression of the coefficient-wise != operator of *this and \a other
00062   *
00063   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
00064   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
00065   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
00066   * isMuchSmallerThan().
00067   *
00068   * Example: \include MatrixBase_cwiseNotEqual.cpp
00069   * Output: \verbinclude MatrixBase_cwiseNotEqual.out
00070   *
00071   * \sa cwiseEqual(), isApprox(), isMuchSmallerThan()
00072   */
00073 template<typename OtherDerived>
00074 inline const CwiseBinaryOp<std::not_equal_to<Scalar>, Derived, OtherDerived>
00075 cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00076 {
00077   return CwiseBinaryOp<std::not_equal_to<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00078 }
00079 
00080 /** \returns an expression of the coefficient-wise min of *this and \a other
00081   *
00082   * Example: \include MatrixBase_cwiseMin.cpp
00083   * Output: \verbinclude MatrixBase_cwiseMin.out
00084   *
00085   * \sa class CwiseBinaryOp, max()
00086   */
00087 template<typename OtherDerived>
00088 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, Derived, OtherDerived>
00089 cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00090 {
00091   return CwiseBinaryOp<internal::scalar_min_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00092 }
00093 
00094 /** \returns an expression of the coefficient-wise max of *this and \a other
00095   *
00096   * Example: \include MatrixBase_cwiseMax.cpp
00097   * Output: \verbinclude MatrixBase_cwiseMax.out
00098   *
00099   * \sa class CwiseBinaryOp, min()
00100   */
00101 template<typename OtherDerived>
00102 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, Derived, OtherDerived>
00103 cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00104 {
00105   return CwiseBinaryOp<internal::scalar_max_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00106 }
00107 
00108 /** \returns an expression of the coefficient-wise quotient of *this and \a other
00109   *
00110   * Example: \include MatrixBase_cwiseQuotient.cpp
00111   * Output: \verbinclude MatrixBase_cwiseQuotient.out
00112   *
00113   * \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse()
00114   */
00115 template<typename OtherDerived>
00116 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>
00117 cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00118 {
00119   return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
00120 }



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011