All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
vector_vari.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_REV_CORE_VECTOR_VARI_HPP
#define STAN_MATH_REV_CORE_VECTOR_VARI_HPP
#include <stan/math/rev/core/var.hpp>
#include <stan/math/rev/core/vari.hpp>
#include <vector>
namespace stan {
namespace math {
class op_vector_vari : public vari {
protected:
const size_t size_;
vari** vis_;
public:
op_vector_vari(double f, const std::vector<stan::math::var>& vs) :
vari(f),
size_(vs.size()) {
vis_ = reinterpret_cast<vari**>
(operator new(sizeof(vari*) * vs.size()));
for (size_t i = 0; i < vs.size(); ++i)
vis_[i] = vs[i].vi_;
}
vari* operator[](size_t n) const {
return vis_[n];
}
size_t size() {
return size_;
}
};
}
}
#endif
stan::math::op_vector_vari::size_
const size_t size_
Definition: vector_vari.hpp:13
vari.hpp
stan::math::vari
The variable implementation base class.
Definition: vari.hpp:28
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–2015, Stan Development Team.