Automatic Differentiation
 
Loading...
Searching...
No Matches
Eigen_NumTraits.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_FUN_EIGEN_NUMTRAITS_HPP
2#define STAN_MATH_FWD_FUN_EIGEN_NUMTRAITS_HPP
3
9#include <limits>
10
11namespace Eigen {
12
17template <typename T>
18struct NumTraits<stan::math::fvar<T>> : GenericNumTraits<stan::math::fvar<T>> {
19 enum {
23 RequireInitialization = 1,
24
28 ReadCost = 2 * NumTraits<double>::ReadCost,
29
37 AddCost = 2 * NumTraits<T>::AddCost,
38
46 MulCost = 3 * NumTraits<T>::MulCost + NumTraits<T>::AddCost
47 };
48
54 static int digits10() { return std::numeric_limits<double>::digits10; }
55};
56
65template <typename T, typename BinaryOp>
66struct ScalarBinaryOpTraits<stan::math::fvar<T>, double, BinaryOp> {
68};
69
78template <typename T, typename BinaryOp>
79struct ScalarBinaryOpTraits<double, stan::math::fvar<T>, BinaryOp> {
81};
82
91template <typename T, typename BinaryOp>
92struct ScalarBinaryOpTraits<stan::math::fvar<T>, int, BinaryOp> {
94};
95
104template <typename T, typename BinaryOp>
105struct ScalarBinaryOpTraits<int, stan::math::fvar<T>, BinaryOp> {
107};
108
117template <typename T, typename BinaryOp>
118struct ScalarBinaryOpTraits<double, std::complex<stan::math::fvar<T>>,
119 BinaryOp> {
120 using ReturnType = std::complex<stan::math::fvar<T>>;
121};
122
131template <typename T, typename BinaryOp>
132struct ScalarBinaryOpTraits<std::complex<stan::math::fvar<T>>, double,
133 BinaryOp> {
134 using ReturnType = std::complex<stan::math::fvar<T>>;
135};
136
145template <typename T, typename BinaryOp>
146struct ScalarBinaryOpTraits<int, std::complex<stan::math::fvar<T>>, BinaryOp> {
147 using ReturnType = std::complex<stan::math::fvar<T>>;
148};
149
158template <typename T, typename BinaryOp>
159struct ScalarBinaryOpTraits<std::complex<stan::math::fvar<T>>, int, BinaryOp> {
160 using ReturnType = std::complex<stan::math::fvar<T>>;
161};
162
171template <typename T, typename BinaryOp>
172struct ScalarBinaryOpTraits<stan::math::fvar<T>, std::complex<double>,
173 BinaryOp> {
174 using ReturnType = std::complex<stan::math::fvar<T>>;
175};
176
185template <typename T, typename BinaryOp>
186struct ScalarBinaryOpTraits<std::complex<double>, stan::math::fvar<T>,
187 BinaryOp> {
188 using ReturnType = std::complex<stan::math::fvar<T>>;
189};
190
199template <typename T, typename BinaryOp>
200struct ScalarBinaryOpTraits<std::complex<double>,
201 std::complex<stan::math::fvar<T>>, BinaryOp> {
202 using ReturnType = std::complex<stan::math::fvar<T>>;
203};
204
213template <typename T, typename BinaryOp>
214struct ScalarBinaryOpTraits<std::complex<stan::math::fvar<T>>,
215 std::complex<double>, BinaryOp> {
216 using ReturnType = std::complex<stan::math::fvar<T>>;
217};
218
219namespace internal {
220
224template <typename EigFvar, typename EigOut>
225struct functor_has_linear_access<
226 stan::math::read_fvar_functor<EigFvar, EigOut>> {
227 enum { ret = 1 };
228};
229
230} // namespace internal
231} // namespace Eigen
232#endif
Specialization of the standard library complex number type for reverse-mode autodiff type stan::math:...
(Expert) Numerical traits for algorithmic differentiation variables.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
STL namespace.
static int digits10()
Return the number of decimal digits that can be represented without change.
This template class represents scalars used in forward-mode automatic differentiation,...
Definition fvar.hpp:40