| Stan Math Library 2.12.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

initialize_variable.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_MAT_FUN_INITIALIZE_VARIABLE_HPP
2 #define STAN_MATH_REV_MAT_FUN_INITIALIZE_VARIABLE_HPP
3
4 #include <stan/math/prim/mat/fun/Eigen.hpp>
5 #include <stan/math/rev/core.hpp>
6 #include <vector>
7
8 namespace stan {
9 namespace math {
10
15 inline void initialize_variable(var& variable, const var& value) {
16 variable = value;
17 }
18
23 template <int R, int C>
24 inline void initialize_variable(Eigen::Matrix<var, R, C>& matrix,
25 const var& value) {
26 for (int i = 0; i < matrix.size(); ++i)
27 matrix(i) = value;
28 }
29
33 template <typename T>
34 inline void initialize_variable(std::vector<T>& variables,
35 const var& value) {
36 for (size_t i = 0; i < variables.size(); ++i)
37 initialize_variable(variables[i], value);
38 }
39
40 }
41 }
42
43 #endif
core.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:30
stan::math::initialize_variable
void initialize_variable(var &variable, const var &value)
Initialize variable to value.
Definition: initialize_variable.hpp:15
Eigen.hpp

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