| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

initialize.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_MAT_FUN_INITIALIZE_HPP
2 #define STAN_MATH_PRIM_MAT_FUN_INITIALIZE_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <boost/type_traits/is_arithmetic.hpp>
6 #include <boost/utility/enable_if.hpp>
7 #include <vector>
8
9 namespace stan {
10
11 namespace math {
12
13 // initializations called for local variables generate in Stan
14 // code; fills in all cells in first arg with second arg
15
16 template <typename T>
17 inline void initialize(T& x, const T& v) {
18 x = v;
19 }
20 template <typename T, typename V>
21 inline
22 typename boost::enable_if_c<boost::is_arithmetic<V>::value, void>::type
23 initialize(T& x, V v) {
24 x = v;
25 }
26 template <typename T, int R, int C, typename V>
27 inline void initialize(Eigen::Matrix<T, R, C>& x, const V& v) {
28 for (int i = 0; i < x.size(); ++i)
29 initialize(x(i), v);
30 }
31 template <typename T, typename V>
32 inline void initialize(std::vector<T>& x, const V& v) {
33 for (size_t i = 0; i < x.size(); ++i)
34 initialize(x[i], v);
35 }
36
37 }
38 }
39 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::initialize
void initialize(T &x, const T &v)
Definition: initialize.hpp:17
Eigen.hpp

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