time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1552B)


      1 
      2 {{alias}}( W )
      3     Returns an accumulator function which incrementally computes a moving
      4     product.
      5 
      6     The `W` parameter defines the number of values over which to compute the
      7     moving product.
      8 
      9     If provided a value, the accumulator function returns an updated moving
     10     product. If not provided a value, the accumulator function returns the
     11     current moving product.
     12 
     13     As `W` values are needed to fill the window buffer, the first `W-1` returned
     14     values are calculated from smaller sample sizes. Until the window is full,
     15     each returned value is calculated from all provided values.
     16 
     17     For accumulations over large windows or accumulations of large numbers, care
     18     should be taken to prevent overflow. Note, however, that overflow/underflow
     19     may be transient, as the accumulator does not use a double-precision
     20     floating-point number to store an accumulated product. Instead, the
     21     accumulator splits an accumulated product into a normalized fraction and
     22     exponent and updates each component separately. Doing so guards against a
     23     loss in precision.
     24 
     25     Parameters
     26     ----------
     27     W: integer
     28         Window size.
     29 
     30     Returns
     31     -------
     32     acc: Function
     33         Accumulator function.
     34 
     35     Examples
     36     --------
     37     > var accumulator = {{alias}}( 3 );
     38     > var p = accumulator()
     39     null
     40     > p = accumulator( 2.0 )
     41     2.0
     42     > p = accumulator( -5.0 )
     43     -10.0
     44     > p = accumulator( 3.0 )
     45     -30.0
     46     > p = accumulator( 5.0 )
     47     -75.0
     48     > p = accumulator()
     49     -75.0
     50 
     51     See Also
     52     --------
     53