Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
initialize_variable.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__MATRIX__INITIALIZE_VARIABLE_HPP
2 #define STAN__AGRAD__REV__MATRIX__INITIALIZE_VARIABLE_HPP
3 
4 #include <vector>
6 #include <stan/agrad/rev/var.hpp>
7 
8 namespace stan {
9  namespace agrad {
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, const var& value) {
25  for (int i = 0; i < matrix.size(); ++i)
26  matrix(i) = value;
27  }
28 
32  template <typename T>
33  inline void initialize_variable(std::vector<T>& variables, const var& value) {
34  for (size_t i = 0; i < variables.size(); ++i)
35  initialize_variable(variables[i],value);
36  }
37 
38  }
39 }
40 
41 #endif
void initialize_variable(var &variable, const var &value)
Initialize variable to value.
Independent (input) and dependent (output) variables for gradients.
Definition: var.hpp:27

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