Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::return_type< Ts > Struct Template Reference

Detailed Description

template<typename... Ts>
struct stan::return_type< Ts >

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, and
  • fvar<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, and
  • complex<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 to
  • T2, and
  • std::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
Template Parameters
Tssequence of input types

Definition at line 207 of file return_type.hpp.

#include <return_type.hpp>

+ Inheritance diagram for stan::return_type< Ts >:

Public Types

using type = double
 

The documentation for this struct was generated from the following file: