|
1 | 1 | """ |
2 | | - WindowedAssociativeOp{T,Op,Op!,V<:AbstractVector{T}} |
| 2 | + WindowedAssociativeOp{T,Op,Op!,V<:AbstractVector{T}}(previous_cumsum::V, values::V) |
| 3 | + WindowedAssociativeOp{T,Op,Op!}() |
| 4 | + WindowedAssociativeOp{T,Op}() |
3 | 5 |
|
4 | 6 | State associated with a windowed aggregation of a binary associative operator. |
5 | 7 |
|
6 | | -If `Op!` is not specifiied, it will default to `Op`. However, for non-bitstypes, it can be |
7 | | -beneficial to provide this methods to reduce memory allocations. |
8 | | -`V` will default to a `Vector{T}`. |
| 8 | +If `Op!` is not specified, it will default to `Op`. However, for non-bitstypes, it can be |
| 9 | +beneficial to provide this method to reduce memory allocations. |
| 10 | +
|
| 11 | +`V` will default to a `Vector{T}`. For windows of a fixed and known length, a circular |
| 12 | +buffer will be more efficient — see `FixedWindowAssociativeOp`. |
9 | 13 |
|
10 | 14 | # Method |
11 | 15 |
|
@@ -37,12 +41,12 @@ cumulative sums. We create a new, empty, `B`. |
37 | 41 | window length. |
38 | 42 |
|
39 | 43 | # Type parameters |
40 | | -- `T`: The type of the values of the array. |
| 44 | +- `T`: The type of the values in the window. |
41 | 45 | - `Op`: Any binary, associative, function. |
42 | | -- `Op!`: Op!(x, y) will perform `x + y`, storing the result in `x`. |
43 | | -- `V`: The subtype of AbstractVector{T} used for internal state. |
| 46 | +- `Op!`: `Op!(x, y)` will perform `x + y`, storing the result in `x`. |
| 47 | +- `V`: The subtype of `AbstractVector{T}` used for internal state. |
44 | 48 |
|
45 | | -# Fields |
| 49 | +# Fields (for internal use only) |
46 | 50 | - `previous_cumsum::Vector{T}`: Corresponds to array `A` above. |
47 | 51 | - `ri_previous_cumsum::Int`: A reverse index into `previous_cumsum`, once it contains |
48 | 52 | values. It should be subtracted from `end` in order to obtain the appropriate index. |
|
0 commit comments