Stan Math Library  2.8.0
reverse mode automatic differentiation
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Groups
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 
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_;
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
The variable implementation base class.
Definition: vari.hpp:28
vari * operator[](size_t n) const
Definition: vector_vari.hpp:24
op_vector_vari(double f, const std::vector< stan::math::var > &vs)
Definition: vector_vari.hpp:16

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