Medial Code Documentation
Loading...
Searching...
No Matches
MatrixCwiseBinaryOps.h
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// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
11// This file is a base class plugin containing matrix specifics coefficient wise functions.
12
20template<typename OtherDerived>
21EIGEN_DEVICE_FUNC
22EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)
23cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
24{
25 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,product)(derived(), other.derived());
26}
27
40template<typename OtherDerived>
41EIGEN_DEVICE_FUNC
42inline const CwiseBinaryOp<numext::equal_to<Scalar>, const Derived, const OtherDerived>
43cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
44{
45 return CwiseBinaryOp<numext::equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
46}
47
60template<typename OtherDerived>
61EIGEN_DEVICE_FUNC
62inline const CwiseBinaryOp<numext::not_equal_to<Scalar>, const Derived, const OtherDerived>
63cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
64{
65 return CwiseBinaryOp<numext::not_equal_to<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
66}
67
75template<int NaNPropagation, typename OtherDerived>
76EIGEN_DEVICE_FUNC
77EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>
78cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
79{
80 return CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
81}
82
83template<typename OtherDerived>
84EIGEN_DEVICE_FUNC
85EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,PropagateFast>, const Derived, const OtherDerived>
86cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
87{
88 return cwiseMin<PropagateFast>(other);
89}
90
95template<int NaNPropagation>
96EIGEN_DEVICE_FUNC
97EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,NaNPropagation>, const Derived, const ConstantReturnType>
98cwiseMin(const Scalar &other) const
99{
100 return cwiseMin<NaNPropagation>(Derived::Constant(rows(), cols(), other));
101}
102
103EIGEN_DEVICE_FUNC
104EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar,Scalar,PropagateFast>, const Derived, const ConstantReturnType>
105cwiseMin(const Scalar &other) const
106{
107 return cwiseMin<PropagateFast>(Derived::Constant(rows(), cols(), other));
108}
109
117template<int NaNPropagation, typename OtherDerived>
118EIGEN_DEVICE_FUNC
119EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>
120cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
121{
122 return CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const OtherDerived>(derived(), other.derived());
123}
124
125template<typename OtherDerived>
126EIGEN_DEVICE_FUNC
127EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,PropagateFast>, const Derived, const OtherDerived>
128cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
129{
130 return cwiseMax<PropagateFast>(other);
131}
132
137template<int NaNPropagation>
138EIGEN_DEVICE_FUNC
139EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,NaNPropagation>, const Derived, const ConstantReturnType>
140cwiseMax(const Scalar &other) const
141{
142 return cwiseMax<NaNPropagation>(Derived::Constant(rows(), cols(), other));
143}
144
145EIGEN_DEVICE_FUNC
146EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar,Scalar,PropagateFast>, const Derived, const ConstantReturnType>
147cwiseMax(const Scalar &other) const
148{
149 return cwiseMax<PropagateFast>(Derived::Constant(rows(), cols(), other));
150}
151
152
160template<typename OtherDerived>
161EIGEN_DEVICE_FUNC
162EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>
163cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
164{
165 return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
166}
167
168typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,Scalar,internal::cmp_EQ>, const Derived, const ConstantReturnType> CwiseScalarEqualReturnType;
169
179EIGEN_DEVICE_FUNC
180inline const CwiseScalarEqualReturnType
181cwiseEqual(const Scalar& s) const
182{
183 return CwiseScalarEqualReturnType(derived(), Derived::Constant(rows(), cols(), s), internal::scalar_cmp_op<Scalar,Scalar,internal::cmp_EQ>());
184}