1 #ifndef STAN_MATH_REV_SCAL_META_OPERANDS_AND_PARTIALS_HPP 2 #define STAN_MATH_REV_SCAL_META_OPERANDS_AND_PARTIALS_HPP 21 : partial_(0), partials_(partial_), operand_(op) {}
24 template <
typename,
typename,
typename,
typename,
typename,
typename>
28 void dump_partials(
double* partials) { *partials = this->partial_; }
29 void dump_operands(
vari** varis) { *varis = this->operand_.
vi_; }
30 int size()
const {
return 1; }
67 template <
typename Op1,
typename Op2,
typename Op3,
typename Op4,
typename Op5>
78 : edge1_(o1), edge2_(o2) {}
80 : edge1_(o1), edge2_(o2), edge3_(o3) {}
83 : edge1_(o1), edge2_(o2), edge3_(o3), edge4_(o4) {}
85 const Op4& o4,
const Op5& o5)
86 : edge1_(o1), edge2_(o2), edge3_(o3), edge4_(o4), edge5_(o5) {}
102 size_t size = edge1_.size() + edge2_.size() + edge3_.size() + edge4_.size()
109 edge1_.dump_operands(&varis[idx]);
110 edge1_.dump_partials(&partials[idx]);
111 edge2_.dump_operands(&varis[idx += edge1_.size()]);
112 edge2_.dump_partials(&partials[idx]);
113 edge3_.dump_operands(&varis[idx += edge2_.size()]);
114 edge3_.dump_partials(&partials[idx]);
115 edge4_.dump_operands(&varis[idx += edge3_.size()]);
116 edge4_.dump_partials(&partials[idx]);
117 edge5_.dump_operands(&varis[idx += edge4_.size()]);
118 edge5_.dump_partials(&partials[idx]);
operands_and_partials(const Op1 &o1, const Op2 &o2, const Op3 &o3, const Op4 &o4)
internal::ops_partials_edge< double, Op3 > edge3_
internal::ops_partials_edge< double, Op4 > edge4_
internal::ops_partials_edge< double, Op2 > edge2_
An edge holds both the operands and its associated partial derivatives.
operands_and_partials(const Op1 &o1)
operands_and_partials(const Op1 &o1, const Op2 &o2, const Op3 &o3)
operands_and_partials(const Op1 &o1, const Op2 &o2)
This template builds partial derivatives with respect to a set of operands.
The variable implementation base class.
static STAN_THREADS_DEF AutodiffStackStorage * instance_
Independent (input) and dependent (output) variables for gradients.
ops_partials_edge(const var &op)
A variable implementation taking a sequence of operands and partial derivatives with respect to the o...
operands_and_partials(const Op1 &o1, const Op2 &o2, const Op3 &o3, const Op4 &o4, const Op5 &o5)
broadcast_array< double > partials_
vari * vi_
Pointer to the implementation of this variable.
var build(double value)
Build the node to be stored on the autodiff graph.
T * alloc_array(size_t n)
Allocate an array on the arena of the specified size to hold values of the specified template paramet...
internal::ops_partials_edge< double, Op5 > edge5_
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
internal::ops_partials_edge< double, Op1 > edge1_