Stan
1.3
probability, sampling & optimization
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerator
Friends
Macros
Pages
src
stan
agrad
rev
matrix
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>
5
#include <
stan/math/matrix/Eigen.hpp
>
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
[
Stan Home Page
]
© 2011–2013, Stan Development Team.