Function vector_sum (o2scl)

O2scl : Function List

template<class vec_t, class data_t>
data_t o2scl::vector_sum(size_t n, const vec_t &data)

Compute the sum of the first n elements of a vector.

If n is zero, this will return 0 without throwing an exception.

template<class vec_t, class data_t>
data_t o2scl::vector_sum(vec_t &data)

Compute the sum of all the elements of a vector.

If the vector has zero size, this will return 0 without calling the error handler.