// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2008-2009 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see . // This file is a base class plugin containing matrix specifics coefficient wise functions. /** \returns an expression of the coefficient-wise absolute value of \c *this * * Example: \include MatrixBase_cwiseAbs.cpp * Output: \verbinclude MatrixBase_cwiseAbs.out * * \sa cwiseAbs2() */ EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> cwiseAbs() const { return derived(); } /** \returns an expression of the coefficient-wise squared absolute value of \c *this * * Example: \include MatrixBase_cwiseAbs2.cpp * Output: \verbinclude MatrixBase_cwiseAbs2.out * * \sa cwiseAbs() */ EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> cwiseAbs2() const { return derived(); } /** \returns an expression of the coefficient-wise square root of *this. * * Example: \include MatrixBase_cwiseSqrt.cpp * Output: \verbinclude MatrixBase_cwiseSqrt.out * * \sa cwisePow(), cwiseSquare() */ inline const CwiseUnaryOp, const Derived> cwiseSqrt() const { return derived(); } /** \returns an expression of the coefficient-wise inverse of *this. * * Example: \include MatrixBase_cwiseInverse.cpp * Output: \verbinclude MatrixBase_cwiseInverse.out * * \sa cwiseProduct() */ inline const CwiseUnaryOp, const Derived> cwiseInverse() const { return derived(); } /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s * * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. * In order to check for equality between two vectors or matrices with floating-point coefficients, it is * generally a far better idea to use a fuzzy comparison as provided by isApprox() and * isMuchSmallerThan(). * * \sa cwiseEqual(const MatrixBase &) const */ inline const CwiseUnaryOp >, const Derived> cwiseEqual(const Scalar& s) const { return CwiseUnaryOp >,const Derived> (derived(), std::bind1st(std::equal_to(), s)); }