Stan Math Library  2.9.0
reverse mode automatic differentiation
length_mvt.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_META_LENGTH_MVT_HPP
2 #define STAN_MATH_PRIM_SCAL_META_LENGTH_MVT_HPP
3 
5 #include <stdexcept>
6 #include <vector>
7 
8 namespace stan {
9 
10  // length_mvt() should only be applied to std vector or Eigen matrix
11  template <typename T>
12  size_t length_mvt(const T& ) {
13  throw std::out_of_range("length_mvt passed to an unrecognized type.");
14  return 1U;
15  }
16  template <typename T, int R, int C>
17  size_t length_mvt(const Eigen::Matrix<T, R, C>& ) {
18  return 1U;
19  }
20  template <typename T, int R, int C>
21  size_t length_mvt(const std::vector<Eigen::Matrix<T, R, C> >& x) {
22  return x.size();
23  }
24 
25 }
26 #endif
27 
size_t length_mvt(const T &)
Definition: length_mvt.hpp:12
void out_of_range(const char *function, const int max, const int index, const char *msg1="", const char *msg2="")
Throw an out_of_range exception with a consistently formatted message.

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