Automatic Differentiation
 
Loading...
Searching...
No Matches
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
7#include <vector>
8
9namespace stan {
10namespace math {
11
12class op_vector_vari : public vari {
13 protected:
14 const size_t size_;
16
17 public:
18 template <typename Arith, typename VecVar,
21 op_vector_vari(Arith f, VecVar&& vs) : vari(f), size_(vs.size()) {
22 vis_ = reinterpret_cast<vari**>(operator new(sizeof(vari*) * vs.size()));
23 for (size_t i = 0; i < vs.size(); ++i) {
24 vis_[i] = vs[i].vi_;
25 }
26 }
27 vari* operator[](size_t n) const { return vis_[n]; }
28 size_t size() { return size_; }
29};
30
31} // namespace math
32} // namespace stan
33#endif
vari * operator[](size_t n) const
op_vector_vari(Arith f, VecVar &&vs)
require_t< std::is_arithmetic< std::decay_t< T > > > require_arithmetic_t
Require type satisfies std::is_arithmetic.
require_t< container_type_check_base< is_vector_like, value_type_t, TypeCheck, Check... > > require_vector_like_vt
Require type satisfies is_vector_like.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...