1 | |
2 | |
3 | typedef CwiseUnaryOp<internal::scalar_abs_op<Scalar>, const Derived> AbsReturnType; |
4 | typedef CwiseUnaryOp<internal::scalar_arg_op<Scalar>, const Derived> ArgReturnType; |
5 | typedef CwiseUnaryOp<internal::scalar_abs2_op<Scalar>, const Derived> Abs2ReturnType; |
6 | typedef CwiseUnaryOp<internal::scalar_sqrt_op<Scalar>, const Derived> SqrtReturnType; |
7 | typedef CwiseUnaryOp<internal::scalar_rsqrt_op<Scalar>, const Derived> RsqrtReturnType; |
8 | typedef CwiseUnaryOp<internal::scalar_sign_op<Scalar>, const Derived> SignReturnType; |
9 | typedef CwiseUnaryOp<internal::scalar_inverse_op<Scalar>, const Derived> InverseReturnType; |
10 | typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType; |
11 | |
12 | typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType; |
13 | typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; |
14 | typedef CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived> Log1pReturnType; |
15 | typedef CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived> Log10ReturnType; |
16 | typedef CwiseUnaryOp<internal::scalar_cos_op<Scalar>, const Derived> CosReturnType; |
17 | typedef CwiseUnaryOp<internal::scalar_sin_op<Scalar>, const Derived> SinReturnType; |
18 | typedef CwiseUnaryOp<internal::scalar_tan_op<Scalar>, const Derived> TanReturnType; |
19 | typedef CwiseUnaryOp<internal::scalar_acos_op<Scalar>, const Derived> AcosReturnType; |
20 | typedef CwiseUnaryOp<internal::scalar_asin_op<Scalar>, const Derived> AsinReturnType; |
21 | typedef CwiseUnaryOp<internal::scalar_atan_op<Scalar>, const Derived> AtanReturnType; |
22 | typedef CwiseUnaryOp<internal::scalar_tanh_op<Scalar>, const Derived> TanhReturnType; |
23 | typedef CwiseUnaryOp<internal::scalar_sinh_op<Scalar>, const Derived> SinhReturnType; |
24 | typedef CwiseUnaryOp<internal::scalar_cosh_op<Scalar>, const Derived> CoshReturnType; |
25 | typedef CwiseUnaryOp<internal::scalar_square_op<Scalar>, const Derived> SquareReturnType; |
26 | typedef CwiseUnaryOp<internal::scalar_cube_op<Scalar>, const Derived> CubeReturnType; |
27 | typedef CwiseUnaryOp<internal::scalar_round_op<Scalar>, const Derived> RoundReturnType; |
28 | typedef CwiseUnaryOp<internal::scalar_floor_op<Scalar>, const Derived> FloorReturnType; |
29 | typedef CwiseUnaryOp<internal::scalar_ceil_op<Scalar>, const Derived> CeilReturnType; |
30 | typedef CwiseUnaryOp<internal::scalar_isnan_op<Scalar>, const Derived> IsNaNReturnType; |
31 | typedef CwiseUnaryOp<internal::scalar_isinf_op<Scalar>, const Derived> IsInfReturnType; |
32 | typedef CwiseUnaryOp<internal::scalar_isfinite_op<Scalar>, const Derived> IsFiniteReturnType; |
33 | |
34 | /** \returns an expression of the coefficient-wise absolute value of \c *this |
35 | * |
36 | * Example: \include Cwise_abs.cpp |
37 | * Output: \verbinclude Cwise_abs.out |
38 | * |
39 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_abs">Math functions</a>, abs2() |
40 | */ |
41 | EIGEN_DEVICE_FUNC |
42 | EIGEN_STRONG_INLINE const AbsReturnType |
43 | abs() const |
44 | { |
45 | return AbsReturnType(derived()); |
46 | } |
47 | |
48 | /** \returns an expression of the coefficient-wise phase angle of \c *this |
49 | * |
50 | * Example: \include Cwise_arg.cpp |
51 | * Output: \verbinclude Cwise_arg.out |
52 | * |
53 | * \sa abs() |
54 | */ |
55 | EIGEN_DEVICE_FUNC |
56 | EIGEN_STRONG_INLINE const ArgReturnType |
57 | arg() const |
58 | { |
59 | return ArgReturnType(derived()); |
60 | } |
61 | |
62 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this |
63 | * |
64 | * Example: \include Cwise_abs2.cpp |
65 | * Output: \verbinclude Cwise_abs2.out |
66 | * |
67 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_abs2">Math functions</a>, abs(), square() |
68 | */ |
69 | EIGEN_DEVICE_FUNC |
70 | EIGEN_STRONG_INLINE const Abs2ReturnType |
71 | abs2() const |
72 | { |
73 | return Abs2ReturnType(derived()); |
74 | } |
75 | |
76 | /** \returns an expression of the coefficient-wise exponential of *this. |
77 | * |
78 | * This function computes the coefficient-wise exponential. The function MatrixBase::exp() in the |
79 | * unsupported module MatrixFunctions computes the matrix exponential. |
80 | * |
81 | * Example: \include Cwise_exp.cpp |
82 | * Output: \verbinclude Cwise_exp.out |
83 | * |
84 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_exp">Math functions</a>, pow(), log(), sin(), cos() |
85 | */ |
86 | EIGEN_DEVICE_FUNC |
87 | inline const ExpReturnType |
88 | exp() const |
89 | { |
90 | return ExpReturnType(derived()); |
91 | } |
92 | |
93 | /** \returns an expression of the coefficient-wise logarithm of *this. |
94 | * |
95 | * This function computes the coefficient-wise logarithm. The function MatrixBase::log() in the |
96 | * unsupported module MatrixFunctions computes the matrix logarithm. |
97 | * |
98 | * Example: \include Cwise_log.cpp |
99 | * Output: \verbinclude Cwise_log.out |
100 | * |
101 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log">Math functions</a>, exp() |
102 | */ |
103 | EIGEN_DEVICE_FUNC |
104 | inline const LogReturnType |
105 | log() const |
106 | { |
107 | return LogReturnType(derived()); |
108 | } |
109 | |
110 | /** \returns an expression of the coefficient-wise logarithm of 1 plus \c *this. |
111 | * |
112 | * In exact arithmetic, \c x.log() is equivalent to \c (x+1).log(), |
113 | * however, with finite precision, this function is much more accurate when \c x is close to zero. |
114 | * |
115 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log1p">Math functions</a>, log() |
116 | */ |
117 | EIGEN_DEVICE_FUNC |
118 | inline const Log1pReturnType |
119 | log1p() const |
120 | { |
121 | return Log1pReturnType(derived()); |
122 | } |
123 | |
124 | /** \returns an expression of the coefficient-wise base-10 logarithm of *this. |
125 | * |
126 | * This function computes the coefficient-wise base-10 logarithm. |
127 | * |
128 | * Example: \include Cwise_log10.cpp |
129 | * Output: \verbinclude Cwise_log10.out |
130 | * |
131 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log10">Math functions</a>, log() |
132 | */ |
133 | EIGEN_DEVICE_FUNC |
134 | inline const Log10ReturnType |
135 | log10() const |
136 | { |
137 | return Log10ReturnType(derived()); |
138 | } |
139 | |
140 | /** \returns an expression of the coefficient-wise square root of *this. |
141 | * |
142 | * This function computes the coefficient-wise square root. The function MatrixBase::sqrt() in the |
143 | * unsupported module MatrixFunctions computes the matrix square root. |
144 | * |
145 | * Example: \include Cwise_sqrt.cpp |
146 | * Output: \verbinclude Cwise_sqrt.out |
147 | * |
148 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sqrt">Math functions</a>, pow(), square() |
149 | */ |
150 | EIGEN_DEVICE_FUNC |
151 | inline const SqrtReturnType |
152 | sqrt() const |
153 | { |
154 | return SqrtReturnType(derived()); |
155 | } |
156 | |
157 | /** \returns an expression of the coefficient-wise inverse square root of *this. |
158 | * |
159 | * This function computes the coefficient-wise inverse square root. |
160 | * |
161 | * Example: \include Cwise_sqrt.cpp |
162 | * Output: \verbinclude Cwise_sqrt.out |
163 | * |
164 | * \sa pow(), square() |
165 | */ |
166 | EIGEN_DEVICE_FUNC |
167 | inline const RsqrtReturnType |
168 | rsqrt() const |
169 | { |
170 | return RsqrtReturnType(derived()); |
171 | } |
172 | |
173 | /** \returns an expression of the coefficient-wise signum of *this. |
174 | * |
175 | * This function computes the coefficient-wise signum. |
176 | * |
177 | * Example: \include Cwise_sign.cpp |
178 | * Output: \verbinclude Cwise_sign.out |
179 | * |
180 | * \sa pow(), square() |
181 | */ |
182 | EIGEN_DEVICE_FUNC |
183 | inline const SignReturnType |
184 | sign() const |
185 | { |
186 | return SignReturnType(derived()); |
187 | } |
188 | |
189 | |
190 | /** \returns an expression of the coefficient-wise cosine of *this. |
191 | * |
192 | * This function computes the coefficient-wise cosine. The function MatrixBase::cos() in the |
193 | * unsupported module MatrixFunctions computes the matrix cosine. |
194 | * |
195 | * Example: \include Cwise_cos.cpp |
196 | * Output: \verbinclude Cwise_cos.out |
197 | * |
198 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cos">Math functions</a>, sin(), acos() |
199 | */ |
200 | EIGEN_DEVICE_FUNC |
201 | inline const CosReturnType |
202 | cos() const |
203 | { |
204 | return CosReturnType(derived()); |
205 | } |
206 | |
207 | |
208 | /** \returns an expression of the coefficient-wise sine of *this. |
209 | * |
210 | * This function computes the coefficient-wise sine. The function MatrixBase::sin() in the |
211 | * unsupported module MatrixFunctions computes the matrix sine. |
212 | * |
213 | * Example: \include Cwise_sin.cpp |
214 | * Output: \verbinclude Cwise_sin.out |
215 | * |
216 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sin">Math functions</a>, cos(), asin() |
217 | */ |
218 | EIGEN_DEVICE_FUNC |
219 | inline const SinReturnType |
220 | sin() const |
221 | { |
222 | return SinReturnType(derived()); |
223 | } |
224 | |
225 | /** \returns an expression of the coefficient-wise tan of *this. |
226 | * |
227 | * Example: \include Cwise_tan.cpp |
228 | * Output: \verbinclude Cwise_tan.out |
229 | * |
230 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_tan">Math functions</a>, cos(), sin() |
231 | */ |
232 | EIGEN_DEVICE_FUNC |
233 | inline const TanReturnType |
234 | tan() const |
235 | { |
236 | return TanReturnType(derived()); |
237 | } |
238 | |
239 | /** \returns an expression of the coefficient-wise arc tan of *this. |
240 | * |
241 | * Example: \include Cwise_atan.cpp |
242 | * Output: \verbinclude Cwise_atan.out |
243 | * |
244 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_atan">Math functions</a>, tan(), asin(), acos() |
245 | */ |
246 | EIGEN_DEVICE_FUNC |
247 | inline const AtanReturnType |
248 | atan() const |
249 | { |
250 | return AtanReturnType(derived()); |
251 | } |
252 | |
253 | /** \returns an expression of the coefficient-wise arc cosine of *this. |
254 | * |
255 | * Example: \include Cwise_acos.cpp |
256 | * Output: \verbinclude Cwise_acos.out |
257 | * |
258 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_acos">Math functions</a>, cos(), asin() |
259 | */ |
260 | EIGEN_DEVICE_FUNC |
261 | inline const AcosReturnType |
262 | acos() const |
263 | { |
264 | return AcosReturnType(derived()); |
265 | } |
266 | |
267 | /** \returns an expression of the coefficient-wise arc sine of *this. |
268 | * |
269 | * Example: \include Cwise_asin.cpp |
270 | * Output: \verbinclude Cwise_asin.out |
271 | * |
272 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_asin">Math functions</a>, sin(), acos() |
273 | */ |
274 | EIGEN_DEVICE_FUNC |
275 | inline const AsinReturnType |
276 | asin() const |
277 | { |
278 | return AsinReturnType(derived()); |
279 | } |
280 | |
281 | /** \returns an expression of the coefficient-wise hyperbolic tan of *this. |
282 | * |
283 | * Example: \include Cwise_tanh.cpp |
284 | * Output: \verbinclude Cwise_tanh.out |
285 | * |
286 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_tanh">Math functions</a>, tan(), sinh(), cosh() |
287 | */ |
288 | EIGEN_DEVICE_FUNC |
289 | inline const TanhReturnType |
290 | tanh() const |
291 | { |
292 | return TanhReturnType(derived()); |
293 | } |
294 | |
295 | /** \returns an expression of the coefficient-wise hyperbolic sin of *this. |
296 | * |
297 | * Example: \include Cwise_sinh.cpp |
298 | * Output: \verbinclude Cwise_sinh.out |
299 | * |
300 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_sinh">Math functions</a>, sin(), tanh(), cosh() |
301 | */ |
302 | EIGEN_DEVICE_FUNC |
303 | inline const SinhReturnType |
304 | sinh() const |
305 | { |
306 | return SinhReturnType(derived()); |
307 | } |
308 | |
309 | /** \returns an expression of the coefficient-wise hyperbolic cos of *this. |
310 | * |
311 | * Example: \include Cwise_cosh.cpp |
312 | * Output: \verbinclude Cwise_cosh.out |
313 | * |
314 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cosh">Math functions</a>, tan(), sinh(), cosh() |
315 | */ |
316 | EIGEN_DEVICE_FUNC |
317 | inline const CoshReturnType |
318 | cosh() const |
319 | { |
320 | return CoshReturnType(derived()); |
321 | } |
322 | |
323 | /** \returns an expression of the coefficient-wise inverse of *this. |
324 | * |
325 | * Example: \include Cwise_inverse.cpp |
326 | * Output: \verbinclude Cwise_inverse.out |
327 | * |
328 | * \sa operator/(), operator*() |
329 | */ |
330 | EIGEN_DEVICE_FUNC |
331 | inline const InverseReturnType |
332 | inverse() const |
333 | { |
334 | return InverseReturnType(derived()); |
335 | } |
336 | |
337 | /** \returns an expression of the coefficient-wise square of *this. |
338 | * |
339 | * Example: \include Cwise_square.cpp |
340 | * Output: \verbinclude Cwise_square.out |
341 | * |
342 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_squareE">Math functions</a>, abs2(), cube(), pow() |
343 | */ |
344 | EIGEN_DEVICE_FUNC |
345 | inline const SquareReturnType |
346 | square() const |
347 | { |
348 | return SquareReturnType(derived()); |
349 | } |
350 | |
351 | /** \returns an expression of the coefficient-wise cube of *this. |
352 | * |
353 | * Example: \include Cwise_cube.cpp |
354 | * Output: \verbinclude Cwise_cube.out |
355 | * |
356 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_cube">Math functions</a>, square(), pow() |
357 | */ |
358 | EIGEN_DEVICE_FUNC |
359 | inline const CubeReturnType |
360 | cube() const |
361 | { |
362 | return CubeReturnType(derived()); |
363 | } |
364 | |
365 | /** \returns an expression of the coefficient-wise round of *this. |
366 | * |
367 | * Example: \include Cwise_round.cpp |
368 | * Output: \verbinclude Cwise_round.out |
369 | * |
370 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_round">Math functions</a>, ceil(), floor() |
371 | */ |
372 | EIGEN_DEVICE_FUNC |
373 | inline const RoundReturnType |
374 | round() const |
375 | { |
376 | return RoundReturnType(derived()); |
377 | } |
378 | |
379 | /** \returns an expression of the coefficient-wise floor of *this. |
380 | * |
381 | * Example: \include Cwise_floor.cpp |
382 | * Output: \verbinclude Cwise_floor.out |
383 | * |
384 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_floor">Math functions</a>, ceil(), round() |
385 | */ |
386 | EIGEN_DEVICE_FUNC |
387 | inline const FloorReturnType |
388 | floor() const |
389 | { |
390 | return FloorReturnType(derived()); |
391 | } |
392 | |
393 | /** \returns an expression of the coefficient-wise ceil of *this. |
394 | * |
395 | * Example: \include Cwise_ceil.cpp |
396 | * Output: \verbinclude Cwise_ceil.out |
397 | * |
398 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_ceil">Math functions</a>, floor(), round() |
399 | */ |
400 | EIGEN_DEVICE_FUNC |
401 | inline const CeilReturnType |
402 | ceil() const |
403 | { |
404 | return CeilReturnType(derived()); |
405 | } |
406 | |
407 | /** \returns an expression of the coefficient-wise isnan of *this. |
408 | * |
409 | * Example: \include Cwise_isNaN.cpp |
410 | * Output: \verbinclude Cwise_isNaN.out |
411 | * |
412 | * \sa isfinite(), isinf() |
413 | */ |
414 | EIGEN_DEVICE_FUNC |
415 | inline const IsNaNReturnType |
416 | isNaN() const |
417 | { |
418 | return IsNaNReturnType(derived()); |
419 | } |
420 | |
421 | /** \returns an expression of the coefficient-wise isinf of *this. |
422 | * |
423 | * Example: \include Cwise_isInf.cpp |
424 | * Output: \verbinclude Cwise_isInf.out |
425 | * |
426 | * \sa isnan(), isfinite() |
427 | */ |
428 | EIGEN_DEVICE_FUNC |
429 | inline const IsInfReturnType |
430 | isInf() const |
431 | { |
432 | return IsInfReturnType(derived()); |
433 | } |
434 | |
435 | /** \returns an expression of the coefficient-wise isfinite of *this. |
436 | * |
437 | * Example: \include Cwise_isFinite.cpp |
438 | * Output: \verbinclude Cwise_isFinite.out |
439 | * |
440 | * \sa isnan(), isinf() |
441 | */ |
442 | EIGEN_DEVICE_FUNC |
443 | inline const IsFiniteReturnType |
444 | isFinite() const |
445 | { |
446 | return IsFiniteReturnType(derived()); |
447 | } |
448 | |
449 | /** \returns an expression of the coefficient-wise ! operator of *this |
450 | * |
451 | * \warning this operator is for expression of bool only. |
452 | * |
453 | * Example: \include Cwise_boolean_not.cpp |
454 | * Output: \verbinclude Cwise_boolean_not.out |
455 | * |
456 | * \sa operator!=() |
457 | */ |
458 | EIGEN_DEVICE_FUNC |
459 | inline const BooleanNotReturnType |
460 | operator!() const |
461 | { |
462 | EIGEN_STATIC_ASSERT((internal::is_same<bool,Scalar>::value), |
463 | THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL); |
464 | return BooleanNotReturnType(derived()); |
465 | } |
466 | |
467 | |
468 | // --- SpecialFunctions module --- |
469 | |
470 | typedef CwiseUnaryOp<internal::scalar_lgamma_op<Scalar>, const Derived> LgammaReturnType; |
471 | typedef CwiseUnaryOp<internal::scalar_digamma_op<Scalar>, const Derived> DigammaReturnType; |
472 | typedef CwiseUnaryOp<internal::scalar_erf_op<Scalar>, const Derived> ErfReturnType; |
473 | typedef CwiseUnaryOp<internal::scalar_erfc_op<Scalar>, const Derived> ErfcReturnType; |
474 | |
475 | /** \cpp11 \returns an expression of the coefficient-wise ln(|gamma(*this)|). |
476 | * |
477 | * \specialfunctions_module |
478 | * |
479 | * Example: \include Cwise_lgamma.cpp |
480 | * Output: \verbinclude Cwise_lgamma.out |
481 | * |
482 | * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, |
483 | * or float/double in non c++11 mode, the user has to provide implementations of lgamma(T) for any scalar |
484 | * type T to be supported. |
485 | * |
486 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_lgamma">Math functions</a>, digamma() |
487 | */ |
488 | EIGEN_DEVICE_FUNC |
489 | inline const LgammaReturnType |
490 | lgamma() const |
491 | { |
492 | return LgammaReturnType(derived()); |
493 | } |
494 | |
495 | /** \returns an expression of the coefficient-wise digamma (psi, derivative of lgamma). |
496 | * |
497 | * \specialfunctions_module |
498 | * |
499 | * \note This function supports only float and double scalar types. To support other scalar types, |
500 | * the user has to provide implementations of digamma(T) for any scalar |
501 | * type T to be supported. |
502 | * |
503 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_digamma">Math functions</a>, Eigen::digamma(), Eigen::polygamma(), lgamma() |
504 | */ |
505 | EIGEN_DEVICE_FUNC |
506 | inline const DigammaReturnType |
507 | digamma() const |
508 | { |
509 | return DigammaReturnType(derived()); |
510 | } |
511 | |
512 | /** \cpp11 \returns an expression of the coefficient-wise Gauss error |
513 | * function of *this. |
514 | * |
515 | * \specialfunctions_module |
516 | * |
517 | * Example: \include Cwise_erf.cpp |
518 | * Output: \verbinclude Cwise_erf.out |
519 | * |
520 | * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, |
521 | * or float/double in non c++11 mode, the user has to provide implementations of erf(T) for any scalar |
522 | * type T to be supported. |
523 | * |
524 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_erf">Math functions</a>, erfc() |
525 | */ |
526 | EIGEN_DEVICE_FUNC |
527 | inline const ErfReturnType |
528 | erf() const |
529 | { |
530 | return ErfReturnType(derived()); |
531 | } |
532 | |
533 | /** \cpp11 \returns an expression of the coefficient-wise Complementary error |
534 | * function of *this. |
535 | * |
536 | * \specialfunctions_module |
537 | * |
538 | * Example: \include Cwise_erfc.cpp |
539 | * Output: \verbinclude Cwise_erfc.out |
540 | * |
541 | * \note This function supports only float and double scalar types in c++11 mode. To support other scalar types, |
542 | * or float/double in non c++11 mode, the user has to provide implementations of erfc(T) for any scalar |
543 | * type T to be supported. |
544 | * |
545 | * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_erfc">Math functions</a>, erf() |
546 | */ |
547 | EIGEN_DEVICE_FUNC |
548 | inline const ErfcReturnType |
549 | erfc() const |
550 | { |
551 | return ErfcReturnType(derived()); |
552 | } |
553 | |