CwiseOperators.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 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_ARRAY_CWISE_OPERATORS_H
11 #define EIGEN_ARRAY_CWISE_OPERATORS_H
12 
13 namespace Eigen {
14 
15 /***************************************************************************
16 * The following functions were defined in Core
17 ***************************************************************************/
18 
19 
21 template<typename ExpressionType>
23 Cwise<ExpressionType>::abs() const
24 {
25  return _expression();
26 }
27 
29 template<typename ExpressionType>
32 {
33  return _expression();
34 }
35 
37 template<typename ExpressionType>
40 {
41  return _expression();
42 }
43 
45 template<typename ExpressionType>
48 {
49  return _expression();
50 }
51 
53 template<typename ExpressionType>
54 template<typename OtherDerived>
57 {
58  return EIGEN_CWISE_PRODUCT_RETURN_TYPE(ExpressionType,OtherDerived)(_expression(), other.derived());
59 }
60 
62 template<typename ExpressionType>
63 template<typename OtherDerived>
66 {
67  return EIGEN_CWISE_BINOP_RETURN_TYPE(internal::scalar_quotient_op)(_expression(), other.derived());
68 }
69 
71 template<typename ExpressionType>
72 template<typename OtherDerived>
74 {
75  return m_matrix.const_cast_derived() = *this * other;
76 }
77 
79 template<typename ExpressionType>
80 template<typename OtherDerived>
82 {
83  return m_matrix.const_cast_derived() = *this / other;
84 }
85 
86 /***************************************************************************
87 * The following functions were defined in Array
88 ***************************************************************************/
89 
90 // -- unary operators --
91 
93 template<typename ExpressionType>
95 Cwise<ExpressionType>::sqrt() const
96 {
97  return _expression();
98 }
99 
101 template<typename ExpressionType>
104 {
105  return _expression();
106 }
107 
108 
110 template<typename ExpressionType>
113 {
114  return _expression();
115 }
116 
117 
119 template<typename ExpressionType>
121 Cwise<ExpressionType>::pow(const Scalar& exponent) const
122 {
124 }
125 
126 
128 template<typename ExpressionType>
131 {
132  return _expression();
133 }
134 
136 template<typename ExpressionType>
139 {
140  return _expression();
141 }
142 
144 template<typename ExpressionType>
147 {
148  return _expression();
149 }
150 
151 
152 // -- binary operators --
153 
155 template<typename ExpressionType>
156 template<typename OtherDerived>
157 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)
159 {
160  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less)(_expression(), other.derived());
161 }
162 
164 template<typename ExpressionType>
165 template<typename OtherDerived>
166 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)
168 {
169  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::less_equal)(_expression(), other.derived());
170 }
171 
173 template<typename ExpressionType>
174 template<typename OtherDerived>
175 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)
177 {
178  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater)(_expression(), other.derived());
179 }
180 
182 template<typename ExpressionType>
183 template<typename OtherDerived>
184 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)
186 {
187  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::greater_equal)(_expression(), other.derived());
188 }
189 
191 template<typename ExpressionType>
192 template<typename OtherDerived>
193 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)
195 {
196  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::equal_to)(_expression(), other.derived());
197 }
198 
200 template<typename ExpressionType>
201 template<typename OtherDerived>
202 inline const EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)
204 {
205  return EIGEN_CWISE_BINOP_RETURN_TYPE(std::not_equal_to)(_expression(), other.derived());
206 }
207 
208 // comparisons to scalar value
209 
211 template<typename ExpressionType>
212 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)
213 Cwise<ExpressionType>::operator<(Scalar s) const
214 {
215  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less)(_expression(),
216  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
217 }
218 
220 template<typename ExpressionType>
221 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)
222 Cwise<ExpressionType>::operator<=(Scalar s) const
223 {
224  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::less_equal)(_expression(),
225  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
226 }
227 
229 template<typename ExpressionType>
230 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)
231 Cwise<ExpressionType>::operator>(Scalar s) const
232 {
233  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater)(_expression(),
234  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
235 }
236 
238 template<typename ExpressionType>
239 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)
240 Cwise<ExpressionType>::operator>=(Scalar s) const
241 {
242  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::greater_equal)(_expression(),
243  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
244 }
245 
247 template<typename ExpressionType>
248 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)
249 Cwise<ExpressionType>::operator==(Scalar s) const
250 {
251  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::equal_to)(_expression(),
252  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
253 }
254 
256 template<typename ExpressionType>
257 inline const EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)
258 Cwise<ExpressionType>::operator!=(Scalar s) const
259 {
260  return EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(std::not_equal_to)(_expression(),
261  typename ExpressionType::ConstantReturnType(_expression().rows(), _expression().cols(), s));
262 }
263 
264 // scalar addition
265 
267 template<typename ExpressionType>
268 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
269 Cwise<ExpressionType>::operator+(const Scalar& scalar) const
270 {
272 }
273 
275 template<typename ExpressionType>
276 inline ExpressionType& Cwise<ExpressionType>::operator+=(const Scalar& scalar)
277 {
278  return m_matrix.const_cast_derived() = *this + scalar;
279 }
280 
282 template<typename ExpressionType>
283 inline const typename Cwise<ExpressionType>::ScalarAddReturnType
285 {
286  return *this + (-scalar);
287 }
288 
290 template<typename ExpressionType>
292 {
293  return m_matrix.const_cast_derived() = *this - scalar;
294 }
295 
296 } // end namespace Eigen
297 
298 #endif // EIGEN_ARRAY_CWISE_OPERATORS_H
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
IntermediateState sqrt(const Expression &arg)
#define EIGEN_STRONG_INLINE
ExpressionType & operator-=(const Scalar &scalar)
CwiseUnaryOp< internal::scalar_add_op< Scalar >, ExpressionType > ScalarAddReturnType
Definition: Cwise.h:57
std::string operator==(const ExportIndex &_arg1, const ExportIndex &_arg2)
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471
IntermediateState pow(const Expression &arg1, const Expression &arg2)
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const Derived > abs2() const
#define EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(OP)
Definition: Cwise.h:28
ExportIndex operator*(const ExportIndex &_arg1, const ExportIndex &_arg2)
IntermediateState cos(const Expression &arg)
ConstraintComponent operator>=(double ub_, const ConstraintComponent &arg)
EIGEN_STRONG_INLINE const CwiseUnaryOp< internal::scalar_abs_op< Scalar >, const Derived > abs() const
const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > inverse() const
#define EIGEN_CWISE_BINOP_RETURN_TYPE(OP)
Definition: Cwise.h:18
Pseudo expression providing additional coefficient-wise operations.
Definition: Cwise.h:50
EIGEN_STRONG_INLINE const EIGEN_CWISE_UNOP_RETURN_TYPE(internal::scalar_abs_op) Cwise< ExpressionType >
ConstraintComponent operator<=(double lb_, const ConstraintComponent &arg)
const CwiseUnaryOp< internal::scalar_cube_op< Scalar >, const Derived > cube() const
ExpressionType & operator+=(const Scalar &scalar)
IntermediateState square(const Expression &arg)
internal::traits< ExpressionType >::Scalar Scalar
Definition: Cwise.h:54
const ScalarAddReturnType operator+(const Scalar &scalar) const
#define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS, RHS)
IntermediateState exp(const Expression &arg)
const ScalarAddReturnType operator-(const Scalar &scalar) const
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:59
ExpressionType & operator/=(const MatrixBase< OtherDerived > &other)
ExpressionType & operator*=(const MatrixBase< OtherDerived > &other)
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
ExportIndex operator/(const ExportIndex &_arg1, const ExportIndex &_arg2)
IntermediateState log(const Expression &arg)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:32