Stan Math Library
4.9.0
Automatic Differentiation
|
Template metaprogram to calculate the base scalar return type resulting from promoting all the scalar types of the template parameters to the least type to which all the base types of the arguments are assignable.
The metaprogram can take an arbitrary number of template parameters.
Complex numbers (instances of std::complex<T>
) are considered scalars. All C++ primitive types (except long double
) are automatically promoted to double
.
The set of autodiff types is defined to be the smallest such that
var
is an autodiff type,fvar<double>
is an autodiff type, andfvar<T>
is an autodiff type if T
is an autodiff type.The set of scalar types is defined to be the smallest such that
double
and long double
are scalar types,T
is a scalar type if T
is an autodiff type,complex<double>
is a scalar type, andcomplex<T>
is a scalar type if T
is an autodiff type.The assignability relation among scalar types is defined to be the smallest such that
double
is assignable to any type T
,T1
is assignable to std::complex<T2>
if T1
is assignable toT2
, andstd::complex<T1>
is assignable to std::complex<T2>
if T1
is assignable to T2
.Example usage:
return_type_t<int, double, float>
is double
return_type_t<double, var>
is var
Ts | sequence of input types |
Definition at line 207 of file return_type.hpp.
#include <return_type.hpp>
Public Types | |
using | type = double |