| 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
dims.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_DIMS_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_DIMS_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <vector>
6
7 namespace stan {
8 namespace math {
9
10 template <typename T>
11 inline
12 void
13 dims(const T& x, std::vector<int>& result) {
14 /* no op */
15 }
16 template <typename T, int R, int C>
17 inline void
18 dims(const Eigen::Matrix<T, R, C>& x,
19 std::vector<int>& result) {
20 result.push_back(x.rows());
21 result.push_back(x.cols());
22 }
23 template <typename T>
24 inline void
25 dims(const std::vector<T>& x,
26 std::vector<int>& result) {
27 result.push_back(x.size());
28 if (x.size() > 0)
29 dims(x[0], result);
30 }
31
32 template <typename T>
33 inline std::vector<int>
34 dims(const T& x) {
35 std::vector<int> result;
36 dims(x, result);
37 return result;
38 }
39
40 }
41 }
42 #endif
stan::math::dims
void dims(const T &x, std::vector< int > &result)
Definition: dims.hpp:13
Eigen.hpp

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