1 #ifndef __STAN__META__TRAITS_HPP__
2 #define __STAN__META__TRAITS_HPP__
5 #include <boost/type_traits.hpp>
6 #include <boost/math/tools/promotion.hpp>
30 enum {
value = boost::is_convertible<T,double>::value };
49 template <
typename T,
int R,
int C>
74 struct is_vector<Eigen::Matrix<T,Eigen::Dynamic,1> > {
79 struct is_vector<Eigen::Matrix<T,1,Eigen::Dynamic> > {
85 template <
bool is_vec,
typename T>
86 struct scalar_type_helper {
91 struct scalar_type_helper<true, T> {
92 typedef typename scalar_type_helper<is_vector<typename T::value_type>::value,
typename T::value_type>::type type;
103 template <
typename T>
105 typedef typename scalar_type_helper<is_vector<T>::value, T>
::type type;
109 template <
typename T>
113 template <
typename T>
118 template <
typename T>
119 size_t length(
const Eigen::Matrix<T,Eigen::Dynamic,1>& v) {
122 template <
typename T>
123 size_t length(
const Eigen::Matrix<T,1,Eigen::Dynamic>& rv) {
127 template<
typename T,
bool is_vec>
141 template <
typename T>
146 template <
typename T1,
typename T2>
148 size_t result =
length(x1);
153 template <
typename T1,
typename T2,
typename T3>
154 size_t max_size(
const T1& x1,
const T2& x2,
const T3& x3) {
155 size_t result =
length(x1);
161 template <
typename T1,
typename T2,
typename T3,
typename T4>
162 size_t max_size(
const T1& x1,
const T2& x2,
const T3& x3,
const T4& x4) {
163 size_t result =
length(x1);
227 template<bool used, typename T = double, bool is_vec = stan::is_vector<T>::value>
232 throw std::runtime_error(
"used is false. this should never be called");
250 std::vector<double> x_;
262 template <
typename T1,
263 typename T2 = double,
264 typename T3 = double,
265 typename T4 = double,
266 typename T5 = double,
267 typename T6 =
double>
270 boost::math::tools::promote_args<typename scalar_type<T1>::type,