Stan Math Library  2.9.0
reverse mode automatic differentiation
scalar_type.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_SCALAR_TYPE_HPP
2 #define STAN_MATH_PRIM_SCAL_META_SCALAR_TYPE_HPP
3 
10 
11 namespace stan {
12 
13  namespace {
14  template <bool is_vec, typename T>
15  struct scalar_type_helper {
16  typedef T type;
17  };
18 
19  template <typename T>
20  struct scalar_type_helper<true, T> {
21  typedef typename
22  scalar_type_helper<is_vector<typename
24  typename stan::math::value_type<T>::type>::type
25  type;
26  };
27  }
36  template <typename T>
37  struct scalar_type {
38  typedef typename scalar_type_helper<is_vector<T>::value, T>::type type;
39  };
40 
41  // ****************** additions for new VV *************************
42  template <typename T>
43  struct scalar_type<Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> > {
44  typedef typename scalar_type<T>::type type;
45  };
46 
47  template <typename T>
48  struct scalar_type<T*> {
49  typedef typename scalar_type<T>::type type;
50  };
51 
52 
53 }
54 #endif
55 
scalar_type< T >::type type
Definition: scalar_type.hpp:49
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:37
scalar_type_helper< is_vector< T >::value, T >::type type
Definition: scalar_type.hpp:38
(Expert) Numerical traits for algorithmic differentiation variables.
Primary template class for metaprogram to compute the type of values stored in a container.
Definition: value_type.hpp:21

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