Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
rev
core
vector_vari.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_REV_CORE_VECTOR_VARI_HPP
2
#define STAN_MATH_REV_CORE_VECTOR_VARI_HPP
3
4
#include <
stan/math/rev/core/var.hpp
>
5
#include <
stan/math/rev/core/vari.hpp
>
6
#include <vector>
7
8
namespace
stan
{
9
namespace
math {
10
11
class
op_vector_vari
:
public
vari
{
12
protected
:
13
const
size_t
size_
;
14
vari
**
vis_
;
15
16
public
:
17
op_vector_vari
(
double
f,
const
std::vector<var>& vs)
18
:
vari
(f), size_(vs.
size
()) {
19
vis_ =
reinterpret_cast<
vari
**
>
(
operator
new
(
sizeof
(
vari
*) * vs.size()));
20
for
(
size_t
i = 0; i < vs.size(); ++i)
21
vis_[i] = vs[i].vi_;
22
}
23
vari
*
operator[]
(
size_t
n)
const
{
return
vis_[n]; }
24
size_t
size
() {
return
size_
; }
25
};
26
27
}
// namespace math
28
}
// namespace stan
29
#endif
stan::math::op_vector_vari::op_vector_vari
op_vector_vari(double f, const std::vector< var > &vs)
Definition:
vector_vari.hpp:17
stan::math::op_vector_vari::size_
const size_t size_
Definition:
vector_vari.hpp:13
vari.hpp
stan::math::op_vector_vari::operator[]
vari * operator[](size_t n) const
Definition:
vector_vari.hpp:23
stan
Definition:
log_sum_exp.hpp:8
stan::math::vari
The variable implementation base class.
Definition:
vari.hpp:30
var.hpp
stan::math::op_vector_vari
Definition:
vector_vari.hpp:11
stan::math::op_vector_vari::vis_
vari ** vis_
Definition:
vector_vari.hpp:14
stan::math::op_vector_vari::size
size_t size()
Definition:
vector_vari.hpp:24
[
Stan Home Page
]
© 2011–2018, Stan Development Team.