Eigen  3.3.3
MatrixCwiseBinaryOps.h
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 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
00010 
00011 // This file is a base class plugin containing matrix specifics coefficient wise functions.
00012 
00020 template<typename OtherDerived>
00021 EIGEN_DEVICE_FUNC
00022 EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)
00023 cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00024 {
00025   return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived());
00026 }
00027 
00040 template<typename OtherDerived>
00041 EIGEN_DEVICE_FUNC
00042 inline const CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>
00043 cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00044 {
00045   return CwiseBinaryOp<std::equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
00046 }
00047 
00060 template<typename OtherDerived>
00061 EIGEN_DEVICE_FUNC
00062 inline const CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>
00063 cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00064 {
00065   return CwiseBinaryOp<std::not_equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
00066 }
00067 
00075 template<typename OtherDerived>
00076 EIGEN_DEVICE_FUNC
00077 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar>, const Derived, const OtherDerived>
00078 cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00079 {
00080   return CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
00081 }
00082 
00087 EIGEN_DEVICE_FUNC
00088 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar>, const Derived, const ConstantReturnType>
00089 cwiseMin(const Scalar &other) const
00090 {
00091   return cwiseMin(Derived::Constant(rows(), cols(), other));
00092 }
00093 
00101 template<typename OtherDerived>
00102 EIGEN_DEVICE_FUNC
00103 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar>, const Derived, const OtherDerived>
00104 cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00105 {
00106   return CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
00107 }
00108 
00113 EIGEN_DEVICE_FUNC
00114 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar>, const Derived, const ConstantReturnType>
00115 cwiseMax(const Scalar &other) const
00116 {
00117   return cwiseMax(Derived::Constant(rows(), cols(), other));
00118 }
00119 
00120 
00128 template<typename OtherDerived>
00129 EIGEN_DEVICE_FUNC
00130 EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
00131 cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
00132 {
00133   return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
00134 }
00135 
00136 typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar,internal::cmp_EQ>, const Derived, const ConstantReturnType> CwiseScalarEqualReturnType;
00137 
00147 EIGEN_DEVICE_FUNC
00148 inline const CwiseScalarEqualReturnType
00149 cwiseEqual(const Scalar& s) const
00150 {
00151   return CwiseScalarEqualReturnType(derived(), Derived::Constant(rows(), cols(), s), internal::scalar_cmp_op<Scalar,Scalar,internal::cmp_EQ>());
00152 }
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends