
| Prototypes | Header File(s) | |
|
template <class T> | ||
|
RWMathVec<T> |
cumsum(const RWMathVec<T>&) |
<rw/math/mathvec.h> |
Takes a vector x and returns a vector y of values corresponding to the cumulative sum of x:

#include <rw/math/mathvec.h>
#include <rw/rstream.h>
double adata[] = {1.2, 2.4, -1.2, 0.8, 4.5 };
main() {
RWMathVec<double> a(adata, 5);
RWMathVec<double> b = cumsum(a);
cout << b;
}
>
Program Output:
[ 1.2 3.6 2.4 3.2 7.7]