| Stan Math Library 2.6.3 probability, sampling & optimization

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
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
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/prim/scal/meta/is_vector.hpp>
6 #include <stan/math/prim/mat/meta/is_vector.hpp>
7 #include <stan/math/prim/arr/meta/is_vector.hpp>
8 #include <stan/math/prim/mat/meta/value_type.hpp>
9 #include <stan/math/prim/scal/meta/value_type.hpp>
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
23 stan::math::value_type<T>::type>::value,
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
stan::scalar_type< T * >::type
scalar_type< T >::type type
Definition: scalar_type.hpp:49
stan::scalar_type
Metaprogram structure to determine the base scalar type of a template argument.
Definition: scalar_type.hpp:37
is_vector.hpp
is_vector.hpp
stan::scalar_type::type
scalar_type_helper< is_vector< T >::value, T >::type type
Definition: scalar_type.hpp:38
value_type.hpp
stan::scalar_type< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > >::type
scalar_type< T >::type type
Definition: scalar_type.hpp:44
Eigen.hpp
value_type.hpp
is_vector.hpp
stan::math::value_type
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.