Main MRPT website > C++ reference
MRPT logo

MatrixCwiseUnaryOps.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 coefficient-wise absolute value of \c *this
00029   *
00030   * Example: \include MatrixBase_cwiseAbs.cpp
00031   * Output: \verbinclude MatrixBase_cwiseAbs.out
00032   *
00033   * \sa cwiseAbs2()
00034   */
00035 EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>,Derived>
00036 cwiseAbs() const { return derived(); }
00037 
00038 /** \returns an expression of the coefficient-wise squared absolute value of \c *this
00039   *
00040   * Example: \include MatrixBase_cwiseAbs2.cpp
00041   * Output: \verbinclude MatrixBase_cwiseAbs2.out
00042   *
00043   * \sa cwiseAbs()
00044   */
00045 EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>,Derived>
00046 cwiseAbs2() const { return derived(); }
00047 
00048 /** \returns an expression of the coefficient-wise square root of *this.
00049   *
00050   * Example: \include MatrixBase_cwiseSqrt.cpp
00051   * Output: \verbinclude MatrixBase_cwiseSqrt.out
00052   *
00053   * \sa cwisePow(), cwiseSquare()
00054   */
00055 inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>,Derived>
00056 cwiseSqrt() const { return derived(); }
00057 
00058 /** \returns an expression of the coefficient-wise inverse of *this.
00059   *
00060   * Example: \include MatrixBase_cwiseInverse.cpp
00061   * Output: \verbinclude MatrixBase_cwiseInverse.out
00062   *
00063   * \sa cwiseProduct()
00064   */
00065 inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>,Derived>
00066 cwiseInverse() const { return derived(); }
00067 
00068 /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s
00069   *
00070   * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
00071   * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
00072   * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
00073   * isMuchSmallerThan().
00074   *
00075   * \sa cwiseEqual(const MatrixBase<OtherDerived> &) const
00076   */
00077 inline const CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >,Derived>
00078 cwiseEqual(const Scalar& s) const
00079 {
00080   return CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >,Derived>
00081           (derived(), std::bind1st(std::equal_to<Scalar>(), s));
00082 }



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