| Stan Math Library 2.11.0 reverse mode automatic differentiation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 public:
16 op_vector_vari(double f, const std::vector<stan::math::var>& vs) :
17 vari(f),
18 size_(vs.size()) {
19 vis_ = reinterpret_cast<vari**>
20 (operator new(sizeof(vari*) * vs.size()));
21 for (size_t i = 0; i < vs.size(); ++i)
22 vis_[i] = vs[i].vi_;
23 }
24 vari* operator[](size_t n) const {
25 return vis_[n];
26 }
27 size_t size() {
28 return size_;
29 }
30 };
31
32 }
33 }
34 #endif
stan::math::op_vector_vari::size_
const size_t size_
Definition: vector_vari.hpp:13
vari.hpp
stan
Definition: log_sum_exp.hpp:8
stan::math::vari
The variable implementation base class.
Definition: vari.hpp:30
stan::math::op_vector_vari::operator[]
vari * operator[](size_t n) const
Definition: vector_vari.hpp:24
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::op_vector_vari
op_vector_vari(double f, const std::vector< stan::math::var > &vs)
Definition: vector_vari.hpp:16
stan::math::op_vector_vari::size
size_t size()
Definition: vector_vari.hpp:27

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