Cumulative Filter | |
---|---|

Description |
Does cumulative calculations on sources. |

Threaded |
No |

Memory Usage |
Heavy, makes new elements |

Stream Support |
Yes |

Added In |
0.3.0 |

## Cumulative Filter

This filter is intended to do cumulative application of a function to a data set. The most straightforward use of this filter would be to calculate a sum over a set of elements to give you a cumulative distribution. The default settings will do this for v[0]. The figure below shows a screen shot of this filter.

The first settings allow you to specify whether the data is already sorted, and if not, what value you want it to be sorted on. This functions just like the Sort Filter. Below that you get to add accumulation functions. For each one you specify a name, an initial value, and a function. The way the filter works is that the function is evaluated for each element in turn and given the value returned by the function on the previous element. The default formula is last+v[0]. You should use "last" as a variable name for the value returned from the previous element. The initial value will be used as the value of "last" for the first element.

The output of this filter includes all the data from the input plus one additional value for each of the accumulation functions that the user specifies. Note that while doing a running sum through a data set is the default behavior and likely the most common one, any arbitrary function can be used. So a running product could be attained with a function such as last*v[0] with an initial value of 1. Similarly, the largest value in a data set up until a given point could be found with a function like (v[0]>last)?v[0]:last.