Automatic Differentiation
 
Loading...
Searching...
No Matches
initialize_variable.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_REV_FUN_INITIALIZE_VARIABLE_HPP
2#define STAN_MATH_REV_FUN_INITIALIZE_VARIABLE_HPP
3
7#include <vector>
8
9namespace stan {
10namespace math {
11
16inline void initialize_variable(var& variable, const var& value) {
17 variable = value;
18}
19
26template <int R, int C>
27inline void initialize_variable(Eigen::Matrix<var, R, C>& matrix,
28 const var& value) {
29 matrix.fill(value);
30}
31
37template <typename T>
38inline void initialize_variable(std::vector<T>& variables, const var& value) {
39 for (size_t i = 0; i < variables.size(); ++i) {
40 initialize_variable(variables[i], value);
41 }
42}
43
44} // namespace math
45} // namespace stan
46
47#endif
void initialize_variable(var &variable, const var &value)
Initialize variable to value.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...