1 #ifndef STAN_MATH_REV_ARR_FUN_SUM_HPP 2 #define STAN_MATH_REV_ARR_FUN_SUM_HPP 19 inline static double sum_of_val(
const std::vector<var>& v) {
28 :
vari(value), v_(v), length_(length) {}
35 for (
size_t i = 0; i <
length_; i++)
40 for (
size_t i = 0; i <
length_; i++) {
52 inline var sum(
const std::vector<var>& m) {
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
sum_v_vari(double value, vari **v, size_t length)
The variable implementation base class.
size_t length(const std::vector< T > &x)
Returns the length of the provided std::vector.
Independent (input) and dependent (output) variables for gradients.
virtual void chain()
Apply the chain rule to this variable based on the variables on which it depends. ...
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
double adj_
The adjoint of this variable, which is the partial derivative of this variable with respect to the ro...
static double sum_of_val(const std::vector< var > &v)
This struct always provides access to the autodiff stack using the singleton pattern.
Class for sums of variables constructed with standard vectors.
sum_v_vari(const std::vector< var > &v1)