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