1 | /** \returns an expression of the coefficient wise product of \c *this and \a other |
---|
2 | * |
---|
3 | * \sa MatrixBase::cwiseProduct |
---|
4 | */ |
---|
5 | template<typename OtherDerived> |
---|
6 | EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived) |
---|
7 | operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const |
---|
8 | { |
---|
9 | return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived()); |
---|
10 | } |
---|
11 | |
---|
12 | /** \returns an expression of the coefficient wise quotient of \c *this and \a other |
---|
13 | * |
---|
14 | * \sa MatrixBase::cwiseQuotient |
---|
15 | */ |
---|
16 | template<typename OtherDerived> |
---|
17 | EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived> |
---|
18 | operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const |
---|
19 | { |
---|
20 | return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); |
---|
21 | } |
---|
22 | |
---|
23 | /** \returns an expression of the coefficient-wise min of \c *this and \a other |
---|
24 | * |
---|
25 | * Example: \include Cwise_min.cpp |
---|
26 | * Output: \verbinclude Cwise_min.out |
---|
27 | * |
---|
28 | * \sa max() |
---|
29 | */ |
---|
30 | EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op) |
---|
31 | |
---|
32 | /** \returns an expression of the coefficient-wise min of \c *this and scalar \a other |
---|
33 | * |
---|
34 | * \sa max() |
---|
35 | */ |
---|
36 | EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_min_op<Scalar>, const Derived, |
---|
37 | const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > |
---|
38 | (min)(const Scalar &other) const |
---|
39 | { |
---|
40 | return (min)(Derived::PlainObject::Constant(rows(), cols(), other)); |
---|
41 | } |
---|
42 | |
---|
43 | /** \returns an expression of the coefficient-wise max of \c *this and \a other |
---|
44 | * |
---|
45 | * Example: \include Cwise_max.cpp |
---|
46 | * Output: \verbinclude Cwise_max.out |
---|
47 | * |
---|
48 | * \sa min() |
---|
49 | */ |
---|
50 | EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op) |
---|
51 | |
---|
52 | /** \returns an expression of the coefficient-wise max of \c *this and scalar \a other |
---|
53 | * |
---|
54 | * \sa min() |
---|
55 | */ |
---|
56 | EIGEN_STRONG_INLINE const CwiseBinaryOp<internal::scalar_max_op<Scalar>, const Derived, |
---|
57 | const CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject> > |
---|
58 | (max)(const Scalar &other) const |
---|
59 | { |
---|
60 | return (max)(Derived::PlainObject::Constant(rows(), cols(), other)); |
---|
61 | } |
---|
62 | |
---|
63 | /** \returns an expression of the coefficient-wise \< operator of *this and \a other |
---|
64 | * |
---|
65 | * Example: \include Cwise_less.cpp |
---|
66 | * Output: \verbinclude Cwise_less.out |
---|
67 | * |
---|
68 | * \sa all(), any(), operator>(), operator<=() |
---|
69 | */ |
---|
70 | EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less) |
---|
71 | |
---|
72 | /** \returns an expression of the coefficient-wise \<= operator of *this and \a other |
---|
73 | * |
---|
74 | * Example: \include Cwise_less_equal.cpp |
---|
75 | * Output: \verbinclude Cwise_less_equal.out |
---|
76 | * |
---|
77 | * \sa all(), any(), operator>=(), operator<() |
---|
78 | */ |
---|
79 | EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal) |
---|
80 | |
---|
81 | /** \returns an expression of the coefficient-wise \> operator of *this and \a other |
---|
82 | * |
---|
83 | * Example: \include Cwise_greater.cpp |
---|
84 | * Output: \verbinclude Cwise_greater.out |
---|
85 | * |
---|
86 | * \sa all(), any(), operator>=(), operator<() |
---|
87 | */ |
---|
88 | EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater) |
---|
89 | |
---|
90 | /** \returns an expression of the coefficient-wise \>= operator of *this and \a other |
---|
91 | * |
---|
92 | * Example: \include Cwise_greater_equal.cpp |
---|
93 | * Output: \verbinclude Cwise_greater_equal.out |
---|
94 | * |
---|
95 | * \sa all(), any(), operator>(), operator<=() |
---|
96 | */ |
---|
97 | EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal) |
---|
98 | |
---|
99 | /** \returns an expression of the coefficient-wise == operator of *this and \a other |
---|
100 | * |
---|
101 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. |
---|
102 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is |
---|
103 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and |
---|
104 | * isMuchSmallerThan(). |
---|
105 | * |
---|
106 | * Example: \include Cwise_equal_equal.cpp |
---|
107 | * Output: \verbinclude Cwise_equal_equal.out |
---|
108 | * |
---|
109 | * \sa all(), any(), isApprox(), isMuchSmallerThan() |
---|
110 | */ |
---|
111 | EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to) |
---|
112 | |
---|
113 | /** \returns an expression of the coefficient-wise != operator of *this and \a other |
---|
114 | * |
---|
115 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. |
---|
116 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is |
---|
117 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and |
---|
118 | * isMuchSmallerThan(). |
---|
119 | * |
---|
120 | * Example: \include Cwise_not_equal.cpp |
---|
121 | * Output: \verbinclude Cwise_not_equal.out |
---|
122 | * |
---|
123 | * \sa all(), any(), isApprox(), isMuchSmallerThan() |
---|
124 | */ |
---|
125 | EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to) |
---|
126 | |
---|
127 | // scalar addition |
---|
128 | |
---|
129 | /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar |
---|
130 | * |
---|
131 | * Example: \include Cwise_plus.cpp |
---|
132 | * Output: \verbinclude Cwise_plus.out |
---|
133 | * |
---|
134 | * \sa operator+=(), operator-() |
---|
135 | */ |
---|
136 | inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> |
---|
137 | operator+(const Scalar& scalar) const |
---|
138 | { |
---|
139 | return CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived>(derived(), internal::scalar_add_op<Scalar>(scalar)); |
---|
140 | } |
---|
141 | |
---|
142 | friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> |
---|
143 | operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other) |
---|
144 | { |
---|
145 | return other + scalar; |
---|
146 | } |
---|
147 | |
---|
148 | /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar |
---|
149 | * |
---|
150 | * Example: \include Cwise_minus.cpp |
---|
151 | * Output: \verbinclude Cwise_minus.out |
---|
152 | * |
---|
153 | * \sa operator+(), operator-=() |
---|
154 | */ |
---|
155 | inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const Derived> |
---|
156 | operator-(const Scalar& scalar) const |
---|
157 | { |
---|
158 | return *this + (-scalar); |
---|
159 | } |
---|
160 | |
---|
161 | friend inline const CwiseUnaryOp<internal::scalar_add_op<Scalar>, const CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const Derived> > |
---|
162 | operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS<Derived>& other) |
---|
163 | { |
---|
164 | return (-other) + scalar; |
---|
165 | } |
---|
166 | |
---|
167 | /** \returns an expression of the coefficient-wise && operator of *this and \a other |
---|
168 | * |
---|
169 | * \warning this operator is for expression of bool only. |
---|
170 | * |
---|
171 | * Example: \include Cwise_boolean_and.cpp |
---|
172 | * Output: \verbinclude Cwise_boolean_and.out |
---|
173 | * |
---|
174 | * \sa operator||(), select() |
---|
175 | */ |
---|
176 | template<typename OtherDerived> |
---|
177 | inline const CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived> |
---|
178 | operator&&(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const |
---|
179 | { |
---|
180 | EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value), |
---|
181 | THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); |
---|
182 | return CwiseBinaryOp<internal::scalar_boolean_and_op, const Derived, const OtherDerived>(derived(),other.derived()); |
---|
183 | } |
---|
184 | |
---|
185 | /** \returns an expression of the coefficient-wise || operator of *this and \a other |
---|
186 | * |
---|
187 | * \warning this operator is for expression of bool only. |
---|
188 | * |
---|
189 | * Example: \include Cwise_boolean_or.cpp |
---|
190 | * Output: \verbinclude Cwise_boolean_or.out |
---|
191 | * |
---|
192 | * \sa operator&&(), select() |
---|
193 | */ |
---|
194 | template<typename OtherDerived> |
---|
195 | inline const CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived> |
---|
196 | operator||(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const |
---|
197 | { |
---|
198 | EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value && internal::is_same<bool,typename OtherDerived::Scalar>::value), |
---|
199 | THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); |
---|
200 | return CwiseBinaryOp<internal::scalar_boolean_or_op, const Derived, const OtherDerived>(derived(),other.derived()); |
---|
201 | } |
---|