cumwsumTopN

Syntax

cumwsumTopN(X, Y, S, top, [ascending=true], [tiesMethod='latest'])

Please see cumTopN for the parameters and windowing logic.

Details

After stably sorting S in the specified ascending order, the function obtains the first top pairs of elements in X and Y in a cumulative window and calculates the cumulative weighted sum of X with Y as the weights.

Return value: DOUBLE type

Examples

X=1 2 3 10 13 4 3
Y = 1 7 8 9 0 5 8
S = 0.3 0.5 0.1 0.1 0.5 0.2 0.4
cumwsumTopN(X, Y, S, 6, 3)
// output
[1,15,39,129,129,149,159]