MatrixCwiseUnaryOps.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // Eigen is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 3 of the License, or (at your option) any later version.
11 //
12 // Alternatively, you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License as
14 // published by the Free Software Foundation; either version 2 of
15 // the License, or (at your option) any later version.
16 //
17 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License and a copy of the GNU General Public License along with
24 // Eigen. If not, see <http://www.gnu.org/licenses/>.
25 
26 // This file is a base class plugin containing matrix specifics coefficient wise functions.
27 
35 EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived>
36 cwiseAbs() const { return derived(); }
37 
45 EIGEN_STRONG_INLINE const CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived>
46 cwiseAbs2() const { return derived(); }
47 
55 inline const CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived>
56 cwiseSqrt() const { return derived(); }
57 
65 inline const CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived>
66 cwiseInverse() const { return derived(); }
67 
77 inline const CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >, const Derived>
78 cwiseEqual(const Scalar& s) const
79 {
80  return CwiseUnaryOp<std::binder1st<std::equal_to<Scalar> >,const Derived>
81  (derived(), std::bind1st(std::equal_to<Scalar>(), s));
82 }