CumulativeVector()
Summary
Constructs a cumulative vector in a new vector.
Changes
Added to Version 6.0/2012.
Syntax
new_vec = CumulativeVector(vector vec[, array options])
| Argument | Contents |
|---|---|
| vec | The vector to be summed cumulatively |
Returns
A new vector with each element containing the sum of the elements up to and including that element in the input vector.
Example
vec = Vector(10, "long", {{"Sequence", 1, 1}})
new_vec = CumulativeVector(vec)
ShowArray({vec, new_vec})
Notes
-
The options array is an optional argument.
-
Missing elements are treated as zero.
-
For more information on vectors, see Vectors.
See Also
| Function | Summary |
|---|---|
| ArrayToVector() | Copies an array to a vector |
| CopyVector() | Copies a vector to a new vector. |
| SortVector() | Sorts the elements of a vector in ascending order |
| SortVectors() | Sorts an array of vectors in ascending order, based on the first vector |
| TransposeArray() | Transposes an array of arrays, where element b[i][j] = a[j][i] |
| Vector() | Creates a vector |
| VectorToArray() | Copies a vector to an array |