OpenKalman
unary.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2023 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_EIGEN_TRAITS_FUNCTORS_UNARY_HPP
17 #define OPENKALMAN_EIGEN_TRAITS_FUNCTORS_UNARY_HPP
18 
19 #include <type_traits>
20 #include <complex>
21 
22 namespace OpenKalman::Eigen3
23 {
24 
25  // Default unary functor traits
26  template<typename Operation>
27  struct UnaryFunctorTraits
28  {
30  static constexpr auto constexpr_operation() = delete;
31 
33  static constexpr bool preserves_triangle = false;
34 
36  static constexpr bool preserves_hermitian = false;
37  };
38 
39 
40 #ifndef __cpp_concepts
41  template<typename UnaryOp, typename = void>
42  struct constexpr_unary_operation_defined_impl : std::false_type {};
43 
44  template<typename UnaryOp>
45  struct constexpr_unary_operation_defined_impl<UnaryOp, std::void_t<decltype(Eigen3::UnaryFunctorTraits<UnaryOp>::constexpr_operation())>>
46  : std::true_type {};
47 #endif
48 
49 
51  template<typename UnaryOp>
52 #ifdef __cpp_concepts
54 #else
55  constexpr bool constexpr_unary_operation_defined = constexpr_unary_operation_defined_impl<std::decay_t<UnaryOp>>::value;
56 #endif
57 
58 
59  // --------------- //
60  // stl operators //
61  // --------------- //
62 
63  template<typename Scalar>
64  struct UnaryFunctorTraits<std::negate<Scalar>>
65  {
66  static constexpr auto constexpr_operation() { return std::negate<Scalar>{}; };
67  static constexpr bool preserves_triangle = true;
68  static constexpr bool preserves_hermitian = true;
69  };
70 
71 
72  template<typename Scalar>
73  struct UnaryFunctorTraits<std::logical_not<Scalar>>
74  {
75  static constexpr auto constexpr_operation() { return std::logical_not<Scalar>{}; };
76  static constexpr bool preserves_triangle = false;
77  static constexpr bool preserves_hermitian = true;
78  };
79 
80 
81  // ----------------- //
82  // Eigen operators //
83  // ----------------- //
84 
85  template<typename Scalar>
86  struct UnaryFunctorTraits<Eigen::internal::scalar_opposite_op<Scalar>> : UnaryFunctorTraits<std::negate<Scalar>> {};
87 
88 
89  template<typename Scalar>
90  struct UnaryFunctorTraits<Eigen::internal::scalar_abs_op<Scalar>>
91  {
92  struct Op { constexpr auto operator()(Scalar arg) const { return values::abs(arg); } };
93  static constexpr auto constexpr_operation() { return Op{}; }
94  static constexpr bool preserves_triangle = true;
95  static constexpr bool preserves_hermitian = true;
96  };
97 
98 
99  template<typename Scalar>
100  struct UnaryFunctorTraits<Eigen::internal::scalar_score_coeff_op<Scalar>>
101  : UnaryFunctorTraits<Eigen::internal::scalar_abs_op<Scalar>> {};
102 
103 
104  // abs_knowing_score not implemented because it is not a true Eigen functor.
105 
106 
107  template<typename Scalar>
108  struct UnaryFunctorTraits<Eigen::internal::scalar_abs2_op<Scalar>>
109  {
110  struct Op1
111  {
112  constexpr auto operator()(Scalar arg) const
113  {
114  auto r = values::real(arg);
115  auto i = values::imag(arg);
116  return r * r + i * i;
117  }
118  };
119  struct Op2 { constexpr auto operator()(Scalar arg) const { return arg * arg; } };
120  static constexpr auto constexpr_operation()
121  {
122  if constexpr (values::complex<Scalar>) return Op1{};
123  else return Op2{};
124  }
125  static constexpr bool preserves_triangle = true;
126  static constexpr bool preserves_hermitian = true;
127  };
128 
129 
130  template<typename Scalar>
131  struct UnaryFunctorTraits<Eigen::internal::scalar_conjugate_op<Scalar>>
132  {
133  struct Op { constexpr auto operator()(Scalar arg) const { return values::conj(arg); } };
134  static constexpr auto constexpr_operation() { return Op{}; }
135  static constexpr bool preserves_triangle = true;
136  static constexpr bool preserves_hermitian = true;
137  };
138 
139 
140  template<typename Scalar>
141  struct UnaryFunctorTraits<Eigen::internal::scalar_arg_op<Scalar>>
142  {
143  struct Op
144  {
145  constexpr auto operator()(Scalar arg) const {
146  return values::atan2(values::imag(arg), values::real(arg));
147  }
148  };
149  static constexpr auto constexpr_operation()
150  {
151  return Op{};
152  }
153  static constexpr bool preserves_triangle = false;
154  static constexpr bool preserves_hermitian = true;
155  };
156 
157 
158  template<typename Scalar, typename NewType>
159  struct UnaryFunctorTraits<Eigen::internal::scalar_cast_op<Scalar, NewType>>
160  {
161  struct Op1
162  {
163  constexpr auto operator()(Scalar arg) const
164  {
165  return static_cast<NewType>(static_cast<typename Eigen::NumTraits<NewType>::Real>(arg));
166  }
167  };
168  struct Op2 { constexpr auto operator()(Scalar arg) const { return static_cast<NewType>(arg); } };
169  static constexpr auto constexpr_operation()
170  {
171  if constexpr (not Eigen::NumTraits<Scalar>::IsComplex and Eigen::NumTraits<NewType>::IsComplex)
172  return Op1{};
173  else
174  return Op2{};
175  }
176  static constexpr bool preserves_triangle = true;
177  static constexpr bool preserves_hermitian = true;
178  };
179 
180 
181 #if EIGEN_VERSION_AT_LEAST(3,4,0)
182  template<typename Scalar, int N>
183  struct UnaryFunctorTraits<Eigen::internal::scalar_shift_right_op<Scalar, N>>
184  {
185  struct Op { constexpr auto operator()(Scalar arg) const { return arg >> N; } };
186  static constexpr auto constexpr_operation() { return Op{}; }
187  static constexpr bool preserves_triangle = true;
188  static constexpr bool preserves_hermitian = true;
189  };
190 
191 
192  template<typename Scalar, int N>
193  struct UnaryFunctorTraits<Eigen::internal::scalar_shift_left_op<Scalar, N>>
194  {
195  struct Op { constexpr auto operator()(Scalar arg) const { return arg << N; } };
196  static constexpr auto constexpr_operation() { return Op{}; }
197  static constexpr bool preserves_triangle = true;
198  static constexpr bool preserves_hermitian = true;
199  };
200 #endif
201 
202 
203  template<typename Scalar>
204  struct UnaryFunctorTraits<Eigen::internal::scalar_real_op<Scalar>>
205  {
206  struct Op { constexpr auto operator()(Scalar arg) const { return values::real(arg); } };
207  static constexpr auto constexpr_operation() { return Op{}; }
208  static constexpr bool preserves_triangle = true;
209  static constexpr bool preserves_hermitian = true;
210  };
211 
212 
213  template<typename Scalar>
214  struct UnaryFunctorTraits<Eigen::internal::scalar_imag_op<Scalar>>
215  {
216  struct Op { constexpr auto operator()(Scalar arg) const { return values::imag(arg); } };
217  static constexpr auto constexpr_operation() { return Op{}; }
218  static constexpr bool preserves_triangle = true;
219  static constexpr bool preserves_hermitian = not values::complex<Scalar>;
220  };
221 
222 
223  template<typename Scalar>
224  struct UnaryFunctorTraits<Eigen::internal::scalar_real_ref_op<Scalar>>
225  : UnaryFunctorTraits<Eigen::internal::scalar_real_op<Scalar>> {};
226 
227 
228  template<typename Scalar>
229  struct UnaryFunctorTraits<Eigen::internal::scalar_imag_ref_op<Scalar>>
230  : UnaryFunctorTraits<Eigen::internal::scalar_imag_op<Scalar>> {};
231 
232 
233  template<typename Scalar>
234  struct UnaryFunctorTraits<Eigen::internal::scalar_exp_op<Scalar>>
235  {
236  struct Op { constexpr auto operator()(Scalar arg) const { return values::exp(arg); } };
237  static constexpr auto constexpr_operation() { return Op{}; }
238  static constexpr bool preserves_triangle = false;
239  static constexpr bool preserves_hermitian = true;
240  };
241 
242 
243 #if EIGEN_VERSION_AT_LEAST(3,4,0)
244  template<typename Scalar>
245  struct UnaryFunctorTraits<Eigen::internal::scalar_expm1_op<Scalar>>
246  {
247  struct Op { constexpr auto operator()(Scalar arg) const { return values::expm1(arg); } };
248  static constexpr auto constexpr_operation() { return Op{}; }
249  static constexpr bool preserves_triangle = true;
250  static constexpr bool preserves_hermitian = true;
251  };
252 #endif
253 
254 
255  template<typename Scalar>
256  struct UnaryFunctorTraits<Eigen::internal::scalar_log_op<Scalar>>
257  {
258  struct Op { constexpr auto operator()(Scalar arg) const { return values::log(arg); } };
259  static constexpr auto constexpr_operation() { return Op{}; }
260  static constexpr bool preserves_triangle = false;
261  static constexpr bool preserves_hermitian = true;
262  };
263 
264 
265  template<typename Scalar>
266  struct UnaryFunctorTraits<Eigen::internal::scalar_log1p_op<Scalar>>
267  {
268  struct Op { constexpr auto operator()(Scalar arg) const { return values::log1p(arg); } };
269  static constexpr auto constexpr_operation() { return Op{}; }
270  static constexpr bool preserves_triangle = true;
271  static constexpr bool preserves_hermitian = true;
272  };
273 
274 
275  template<typename Scalar>
276  struct UnaryFunctorTraits<Eigen::internal::scalar_log10_op<Scalar>>
277  {
278  struct Op
279  {
280  constexpr auto operator()(Scalar arg) const
281  {
282  using S = std::decay_t<decltype(values::real(arg))>;
283  return values::log(arg) / numbers::ln10_v<S>;
284  }
285  };
286  static constexpr auto constexpr_operation() { return Op{}; }
287  static constexpr bool preserves_triangle = false;
288  static constexpr bool preserves_hermitian = true;
289  };
290 
291 
292 #if EIGEN_VERSION_AT_LEAST(3,4,0)
293  template<typename Scalar>
294  struct UnaryFunctorTraits<Eigen::internal::scalar_log2_op<Scalar>>
295  {
296  struct Op
297  {
298  constexpr auto operator()(Scalar arg) const
299  {
300  using S = std::decay_t<decltype(values::real(arg))>;
301  return values::log(arg) / numbers::ln2_v<S>;
302  }
303  };
304  static constexpr auto constexpr_operation() { return Op{}; }
305  static constexpr bool preserves_triangle = false;
306  static constexpr bool preserves_hermitian = true;
307  };
308 #endif
309 
310 
311  template<typename Scalar>
312  struct UnaryFunctorTraits<Eigen::internal::scalar_sqrt_op<Scalar>>
313  {
314  struct Op { constexpr auto operator()(Scalar arg) const { return values::sqrt(arg); } };
315  static constexpr auto constexpr_operation() { return Op{}; }
316  static constexpr bool preserves_triangle = true;
317  static constexpr bool preserves_hermitian = true;
318  };
319 
320 
321  template<typename Scalar>
322  struct UnaryFunctorTraits<Eigen::internal::scalar_rsqrt_op<Scalar>>
323  {
324  struct Op
325  {
326  constexpr auto operator()(Scalar arg) const
327  {
328  if (arg == Scalar{0}) return values::internal::NaN<Scalar>();
329  else return Scalar{1} / values::sqrt(arg);
330  }
331  };
332  static constexpr auto constexpr_operation() { return Op{}; }
333  static constexpr bool preserves_triangle = false;
334  static constexpr bool preserves_hermitian = true;
335  };
336 
337 
338  template<typename Scalar>
339  struct UnaryFunctorTraits<Eigen::internal::scalar_cos_op<Scalar>>
340  {
341  struct Op { constexpr auto operator()(Scalar arg) const { return values::cos(arg); } };
342  static constexpr auto constexpr_operation() { return Op{}; }
343  static constexpr bool preserves_triangle = false;
344  static constexpr bool preserves_hermitian = true;
345  };
346 
347 
348  template<typename Scalar>
349  struct UnaryFunctorTraits<Eigen::internal::scalar_sin_op<Scalar>>
350  {
351  struct Op { constexpr auto operator()(Scalar arg) const { return values::sin(arg); } };
352  static constexpr auto constexpr_operation() { return Op{}; }
353  static constexpr bool preserves_triangle = true;
354  static constexpr bool preserves_hermitian = true;
355  };
356 
357 
358  template<typename Scalar>
359  struct UnaryFunctorTraits<Eigen::internal::scalar_tan_op<Scalar>>
360  {
361  struct Op { constexpr auto operator()(Scalar arg) const { return values::tan(arg); } };
362  static constexpr auto constexpr_operation() { return Op{}; }
363  static constexpr bool preserves_triangle = true;
364  static constexpr bool preserves_hermitian = true;
365  };
366 
367 
368  template<typename Scalar>
369  struct UnaryFunctorTraits<Eigen::internal::scalar_acos_op<Scalar>>
370  {
371  struct Op { constexpr auto operator()(Scalar arg) const { return values::acos(arg); } };
372  static constexpr auto constexpr_operation() { return Op{}; }
373  static constexpr bool preserves_triangle = false;
374  static constexpr bool preserves_hermitian = true;
375  };
376 
377 
378  template<typename Scalar>
379  struct UnaryFunctorTraits<Eigen::internal::scalar_asin_op<Scalar>>
380  {
381  struct Op { constexpr auto operator()(Scalar arg) const { return values::asin(arg); } };
382  static constexpr auto constexpr_operation() { return Op{}; }
383  static constexpr bool preserves_triangle = true;
384  static constexpr bool preserves_hermitian = true;
385  };
386 
387 
388  template<typename Scalar>
389  struct UnaryFunctorTraits<Eigen::internal::scalar_atan_op<Scalar>>
390  {
391  struct Op { constexpr auto operator()(Scalar arg) const { return values::atan(arg); } };
392  static constexpr auto constexpr_operation() { return Op{}; }
393  static constexpr bool preserves_triangle = true;
394  static constexpr bool preserves_hermitian = true;
395  };
396 
397 
398  template<typename Scalar>
399  struct UnaryFunctorTraits<Eigen::internal::scalar_tanh_op<Scalar>>
400  {
401  struct Op { constexpr auto operator()(Scalar arg) const { return values::tanh(arg); } };
402  static constexpr auto constexpr_operation() { return Op{}; }
403  static constexpr bool preserves_triangle = true;
404  static constexpr bool preserves_hermitian = true;
405  };
406 
407 
408 #if EIGEN_VERSION_AT_LEAST(3,4,0)
409  template<typename Scalar>
410  struct UnaryFunctorTraits<Eigen::internal::scalar_atanh_op<Scalar>>
411  {
412  struct Op { constexpr auto operator()(Scalar arg) const { return values::atanh(arg); } };
413  static constexpr auto constexpr_operation() { return Op{}; }
414  static constexpr bool preserves_triangle = true;
415  static constexpr bool preserves_hermitian = true;
416  };
417 #endif
418 
419 
420  template<typename Scalar>
421  struct UnaryFunctorTraits<Eigen::internal::scalar_sinh_op<Scalar>>
422  {
423  struct Op { constexpr auto operator()(Scalar arg) const { return values::sinh(arg); } };
424  static constexpr auto constexpr_operation() { return Op{}; }
425  static constexpr bool preserves_triangle = true;
426  static constexpr bool preserves_hermitian = true;
427  };
428 
429 
430 #if EIGEN_VERSION_AT_LEAST(3,4,0)
431  template<typename Scalar>
432  struct UnaryFunctorTraits<Eigen::internal::scalar_asinh_op<Scalar>>
433  {
434  struct Op { constexpr auto operator()(Scalar arg) const { return values::asinh(arg); } };
435  static constexpr auto constexpr_operation() { return Op{}; }
436  static constexpr bool preserves_triangle = true;
437  static constexpr bool preserves_hermitian = true;
438  };
439 #endif
440 
441 
442  template<typename Scalar>
443  struct UnaryFunctorTraits<Eigen::internal::scalar_cosh_op<Scalar>>
444  {
445  struct Op { constexpr auto operator()(Scalar arg) const { return values::cosh(arg); } };
446  static constexpr auto constexpr_operation() { return Op{}; }
447  static constexpr bool preserves_triangle = false;
448  static constexpr bool preserves_hermitian = true;
449  };
450 
451 
452 #if EIGEN_VERSION_AT_LEAST(3,4,0)
453  template<typename Scalar>
454  struct UnaryFunctorTraits<Eigen::internal::scalar_acosh_op<Scalar>>
455  {
456  struct Op { constexpr auto operator()(Scalar arg) const { return values::acosh(arg); } };
457  static constexpr auto constexpr_operation() { return Op{}; }
458  static constexpr bool preserves_triangle = false;
459  static constexpr bool preserves_hermitian = true;
460  };
461 # endif
462 
463 
464  template<typename Scalar>
465  struct UnaryFunctorTraits<Eigen::internal::scalar_inverse_op<Scalar>>
466  {
467  struct Op
468  {
469  constexpr auto operator()(Scalar arg) const
470  {
471  if (arg == Scalar{0}) return values::internal::NaN<Scalar>();
472  else return static_cast<Scalar>(1) / arg;
473  }
474  };
475  static constexpr auto constexpr_operation() { return Op{}; }
476  static constexpr bool preserves_triangle = false;
477  static constexpr bool preserves_hermitian = true;
478  };
479 
480 
481  template<typename Scalar>
482  struct UnaryFunctorTraits<Eigen::internal::scalar_square_op<Scalar>>
483  {
484  struct Op { constexpr auto operator()(Scalar arg) const { return arg * arg; } };
485  static constexpr auto constexpr_operation() { return Op{}; }
486  static constexpr bool preserves_triangle = true;
487  static constexpr bool preserves_hermitian = true;
488  };
489 
490 
491  template<typename Scalar>
492  struct UnaryFunctorTraits<Eigen::internal::scalar_cube_op<Scalar>>
493  {
494  struct Op { constexpr auto operator()(Scalar arg) const { return arg * arg * arg; } };
495  static constexpr auto constexpr_operation() { return Op{}; }
496  static constexpr bool preserves_triangle = true;
497  static constexpr bool preserves_hermitian = true;
498  };
499 
500 
501  // Eigen::internal::scalar_round_op not implemented
502  // Eigen::internal::scalar_floor_op not implemented
503  // Eigen::internal::scalar_rint_op not implemented (Eigen 3.4+)
504  // Eigen::internal::scalar_ceil_op not implemented
505  // Eigen::internal::scalar_isnan_op not implemented
506  // Eigen::internal::scalar_isinf_op not implemented
507  // Eigen::internal::scalar_isfinite_op not implemented
508 
509 
510  template<typename Scalar>
511  struct UnaryFunctorTraits<Eigen::internal::scalar_boolean_not_op<Scalar>>
512  : UnaryFunctorTraits<std::logical_not<Scalar>> {};
513 
514 
515  // Eigen::internal::scalar_sign_op not implemented
516 
517 
518 #if EIGEN_VERSION_AT_LEAST(3,4,0)
519  template<typename Scalar>
520  struct UnaryFunctorTraits<Eigen::internal::scalar_logistic_op<Scalar>>
521  {
522  struct Op
523  {
524  constexpr auto operator()(Scalar arg) const { return Scalar{1} / (Scalar{1} + (values::exp(-arg))); }
525  };
526  static constexpr auto constexpr_operation() { return Op{}; }
527  static constexpr bool preserves_triangle = false;
528  static constexpr bool preserves_hermitian = true;
529  };
530 #endif
531 
532 
533  template<typename BinaryOp>
534  struct UnaryFunctorTraits<Eigen::internal::bind1st_op<BinaryOp>>
535  {
537  static constexpr bool preserves_triangle = BinaryTraits::binary_functor_type == BinaryFunctorType::product;
538  static constexpr bool preserves_hermitian = BinaryTraits::preserves_hermitian;
539 
540  template<typename UnaryOp, typename XprType>
541  static constexpr auto get_constant(const Eigen::CwiseUnaryOp<UnaryOp, XprType>& arg)
542  {
543  using CFunctor = Eigen::internal::scalar_constant_op<scalar_type_of_t<XprType>>;
544  using ConstType = Eigen::CwiseNullaryOp<CFunctor, XprType>;
545  using BinaryOpType = Eigen::CwiseBinaryOp<BinaryOp, ConstType, XprType>;
546  const auto& x = arg.nestedExpression();
547  BinaryOpType bin {ConstType{x.rows(), x.cols(), CFunctor{arg.functor().m_value}}, x, arg.functor()};
548  return constant_coefficient {bin};
549  }
550 
551  template<typename UnaryOp, typename XprType>
552  static constexpr auto get_constant_diagonal(const Eigen::CwiseUnaryOp<UnaryOp, XprType>& arg)
553  {
554  using CFunctor = Eigen::internal::scalar_constant_op<scalar_type_of_t<XprType>>;
555  using ConstType = Eigen::CwiseNullaryOp<CFunctor, XprType>;
556  using BinaryOpType = Eigen::CwiseBinaryOp<BinaryOp, ConstType, XprType>;
557  const auto& x = arg.nestedExpression();
558  BinaryOpType bin {ConstType{x.rows(), x.cols(), CFunctor{arg.functor().m_value}}, x, arg.functor()};
559  return constant_diagonal_coefficient {bin};
560  }
561  };
562 
563 
564  template<typename BinaryOp>
565  struct UnaryFunctorTraits<Eigen::internal::bind2nd_op<BinaryOp>>
566  {
568  static constexpr bool preserves_triangle = BinaryTraits::binary_functor_type == BinaryFunctorType::product;
569  static constexpr bool preserves_hermitian = BinaryTraits::preserves_hermitian;
570 
571  template<typename UnaryOp, typename XprType>
572  static constexpr auto get_constant(const Eigen::CwiseUnaryOp<UnaryOp, XprType>& arg)
573  {
574  using CFunctor = Eigen::internal::scalar_constant_op<scalar_type_of_t<XprType>>;
575  using ConstType = Eigen::CwiseNullaryOp<CFunctor, XprType>;
576  using BinaryOpType = Eigen::CwiseBinaryOp<BinaryOp, XprType, ConstType>;
577  const auto& x = arg.nestedExpression();
578  BinaryOpType bin {x, ConstType{x.rows(), x.cols(), CFunctor{arg.functor().m_value}}, arg.functor()};
579  return constant_coefficient {bin};
580  }
581 
582  template<typename UnaryOp, typename XprType>
583  static constexpr auto get_constant_diagonal(const Eigen::CwiseUnaryOp<UnaryOp, XprType>& arg)
584  {
585  using CFunctor = Eigen::internal::scalar_constant_op<scalar_type_of_t<XprType>>;
586  using ConstType = Eigen::CwiseNullaryOp<CFunctor, XprType>;
587  using BinaryOpType = Eigen::CwiseBinaryOp<BinaryOp, XprType, ConstType>;
588  const auto& x = arg.nestedExpression();
589  BinaryOpType bin {x, ConstType{x.rows(), x.cols(), CFunctor{arg.functor().m_value}}, arg.functor()};
590  return constant_diagonal_coefficient {bin};
591  }
592  };
593 
594 
595 } // namespace OpenKalman::Eigen3
596 
597 #endif //OPENKALMAN_EIGEN_TRAITS_FUNCTORS_UNARY_HPP
constexpr auto log(const Arg &arg)
Constexpr alternative to the std::log function.
Definition: log.hpp:47
constexpr auto cosh(const Arg &arg)
Constexpr alternative to the std::cosh function.
Definition: cosh.hpp:44
constexpr auto atanh(const Arg &arg)
Constexpr alternative to the std::atanh function.
Definition: atanh.hpp:42
Definition: eigen-forward-declarations.hpp:41
constexpr auto imag(Arg arg)
A constexpr function to obtain the imaginary part of a (complex) number.
Definition: imag.hpp:40
Definition: eigen-comma-initializers.hpp:20
Definition: tuple_reverse.hpp:103
constexpr bool value
T is numerical value or is reducible to a numerical value.
Definition: value.hpp:31
constexpr auto sin(const Arg &arg)
Constexpr alternative to the std::sin function.
Definition: sin.hpp:43
The constant associated with T, assuming T is a constant_matrix.
Definition: constant_coefficient.hpp:36
constexpr auto acosh(const Arg &arg)
Constexpr alternative to the std::acosh function.
Definition: acosh.hpp:43
constexpr auto atan(const Arg &arg)
Constexpr alternative to the std::atan function.
Definition: atan.hpp:42
static constexpr auto constexpr_operation()=delete
Construct Operation or (preferably) an equivalent constexpr operation equivalent to Operation...
constexpr auto cos(const Arg &arg, std::enable_if_t< values::value< Arg >, int >=0)
Constexpr alternative to the std::cos function.
Definition: cos.hpp:43
constexpr auto log1p(const Arg &arg)
Constexpr alternative to the std::log1p function, where log1p(x) = log(x+1).
Definition: log1p.hpp:60
The constant associated with T, assuming T is a constant_diagonal_matrix.
Definition: constant_diagonal_coefficient.hpp:32
constexpr auto conj(const Arg &arg)
A constexpr function for the complex conjugate of a (complex) number.
Definition: conj.hpp:39
constexpr auto sqrt(const Arg &arg)
A constexpr alternative to std::sqrt.
Definition: sqrt.hpp:46
constexpr auto atan2(const Y &y_arg, const X &x_arg)
Constexpr alternative to the std::atan2 function.
Definition: atan2.hpp:46
Definition: eigen-forward-declarations.hpp:22
Definition: eigen-forward-declarations.hpp:61
constexpr auto real(Arg arg)
A constexpr function to obtain the real part of a (complex) number.
Definition: real.hpp:40
constexpr auto tan(const Arg &arg)
Constexpr alternative to the std::tan function.
Definition: tan.hpp:42
constexpr auto acos(const Arg &arg)
Constexpr alternative to the std::acos function.
Definition: acos.hpp:41
static constexpr bool preserves_hermitian
Whether the operation applied to a hermitian matrix always yields a hermitian matrix.
Definition: unary.hpp:36
constexpr auto abs(const Arg &arg)
A constexpr alternative to std::abs.
Definition: abs.hpp:38
constexpr bool constexpr_unary_operation_defined
Whether there is a constexpr version of functor UnaryOp.
Definition: unary.hpp:55
constexpr auto asinh(const Arg &arg)
Constexpr alternative to the std::asinh function.
Definition: asinh.hpp:43
constexpr auto asin(const Arg &arg)
Constexpr alternative to the std::asin function.
Definition: asin.hpp:44
static constexpr bool preserves_triangle
Whether the operation applied to a triangular matrix always yields a triangular matrix.
Definition: unary.hpp:33
constexpr auto expm1(const Arg &arg)
Constexpr alternative to the std::expm1 function (exponential function minus 1).
Definition: expm1.hpp:48
constexpr auto sinh(const Arg &arg)
Constexpr alternative to the std::sinh function.
Definition: sinh.hpp:48