| Stan Math Library 2.12.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 namespace math {
11
12 // initializations called for local variables generate in Stan
13 // code; fills in all cells in first arg with second arg
14
15 template <typename T>
16 inline void initialize(T& x, const T& v) {
17 x = v;
18 }
19 template <typename T, typename V>
20 inline
21 typename boost::enable_if_c<boost::is_arithmetic<V>::value, void>::type
22 initialize(T& x, V v) {
23 x = v;
24 }
25 template <typename T, int R, int C, typename V>
26 inline void initialize(Eigen::Matrix<T, R, C>& x, const V& v) {
27 for (int i = 0; i < x.size(); ++i)
28 initialize(x(i), v);
29 }
30 template <typename T, typename V>
31 inline void initialize(std::vector<T>& x, const V& v) {
32 for (size_t i = 0; i < x.size(); ++i)
33 initialize(x[i], v);
34 }
35
36 }
37 }
38 #endif
stan
Definition: log_sum_exp.hpp:8
stan::math::initialize
void initialize(T &x, const T &v)
Definition: initialize.hpp:16
Eigen.hpp

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