Stan Math Library: stan/math/prim/scal/fun/promote_scalar.hpp Source File

| Stan Math Library 2.10.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

promote_scalar.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_PROMOTE_SCALAR_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_PROMOTE_SCALAR_HPP
3
4 #include <stan/math/prim/scal/fun/promote_scalar_type.hpp>
5 #include <stan/math/prim/scal/meta/index_type.hpp>
6
7 namespace stan {
8 namespace math {
9
18 template <typename T, typename S>
19 struct promote_scalar_struct {
31 static T apply(S x) {
32 return T(x);
33 }
34 };
35
43 template <typename T>
44 struct promote_scalar_struct<T, T> {
51 static T apply(const T& x) {
52 return x;
53 }
54 };
55
65 template <typename T, typename S>
66 typename promote_scalar_type<T, S>::type
67 promote_scalar(const S& x) {
68 return promote_scalar_struct<T, S>::apply(x);
69 }
70
71 }
72 }
73 #endif
index_type.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::promote_scalar_struct< T, T >::apply
static T apply(const T &x)
Return the unmodified input.
Definition: promote_scalar.hpp:51
stan::math::promote_scalar
promote_scalar_type< T, S >::type promote_scalar(const S &x)
This is the top-level function to call to promote the scalar types of an input of type S to type T...
Definition: promote_scalar.hpp:67
stan::math::promote_scalar_struct
General struct to hold static function for promoting underlying scalar types.
Definition: promote_scalar.hpp:19
promote_scalar_type.hpp
stan::math::promote_scalar_struct::apply
static T apply(S x)
Return the value of the input argument promoted to the type specified by the template parameter...
Definition: promote_scalar.hpp:31

[ Stan Home Page ] © 2011–2016, Stan Development Team.