1 #ifndef STAN_MATH_REV_MAT_FUN_SUM_HPP
2 #define STAN_MATH_REV_MAT_FUN_SUM_HPP
19 template <
typename Derived>
20 inline static double sum_of_val(
const Eigen::DenseBase<Derived>& v) {
22 for (
int i = 0; i < v.size(); i++)
23 result += v(i).vi_->val_;
28 template <
int R1,
int C1>
35 for (
size_t i = 0; i <
length_; i++)
49 template <
int R,
int C>
50 inline var sum(
const Eigen::Matrix<var, R, C>& m) {
fvar< T > sum(const std::vector< fvar< T > > &m)
Return the sum of the entries of the specified standard vector.
sum_eigen_v_vari(const Eigen::Matrix< var, R1, C1 > &v1)
static double sum_of_val(const Eigen::DenseBase< Derived > &v)
The variable implementation base class.
Independent (input) and dependent (output) variables for gradients.
Class for representing sums with constructors for Eigen.
int size(const std::vector< T > &x)
Return the size of the specified standard vector.
Class for sums of variables constructed with standard vectors.