Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "stats/incr/mminmax/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

accumulator

accumulator: (x?: undefined | number) => ArrayLike<number> | null

If provided a value, the accumulator function returns updated minimum and maximum values. If not provided a value, the accumulator function returns the current minimum and maximum values.

Notes

  • If provided NaN, the minimum and maximum values are equal to NaN for all future invocations.
param

input value

returns

output array or null

Type declaration

    • (x?: undefined | number): ArrayLike<number> | null
    • Parameters

      • Optional x: undefined | number

      Returns ArrayLike < number > | null

Functions

Export assignment incrmminmax

  • Returns an accumulator function which incrementally computes moving minimum and maximum values.

    Notes

    • The W parameter defines the number of values over which to compute the moving minimum and maximum.
    • As W values are needed to fill the window buffer, the first W-1 returned minimum and maximum values are calculated from smaller sample sizes. Until the window is full, each returned minimum and maximum is calculated from all provided values.
    throws

    window size must be a positive integer

    Parameters

    • out: ArrayLike<number>

      output array

    • window: number

      window size

    Returns accumulator

    accumulator function

    Example

    var Float64Array = require( `@stdlib/array/float64` );
    
    var accumulator = incrmminmax( new Float64Array( 2 ), 3 );
    
    var mm = accumulator();
    // returns null
    
    mm = accumulator( 2.0 );
    // returns [ 2.0, 2.0 ]
    
    mm = accumulator( -5.0 );
    // returns [ -5.0, 2.0 ]
    
    mm = accumulator( 3.0 );
    // returns [ -5.0, 3.0 ]
    
    mm = accumulator( 5.0 );
    // returns [ -5.0, 5.0 ]
    
    mm = accumulator();
    // returns [ -5.0, 5.0 ]
  • Returns an accumulator function which incrementally computes moving minimum and maximum values.

    Notes

    • The W parameter defines the number of values over which to compute the moving minimum and maximum.
    • As W values are needed to fill the window buffer, the first W-1 returned minimum and maximum values are calculated from smaller sample sizes. Until the window is full, each returned minimum and maximum is calculated from all provided values.
    throws

    window size must be a positive integer

    Parameters

    • window: number

      window size

    Returns accumulator

    accumulator function

    Example

    var accumulator = incrmminmax( 3 );
    
    var mm = accumulator();
    // returns null
    
    mm = accumulator( 2.0 );
    // returns [ 2.0, 2.0 ]
    
    mm = accumulator( -5.0 );
    // returns [ -5.0, 2.0 ]
    
    mm = accumulator( 3.0 );
    // returns [ -5.0, 3.0 ]
    
    mm = accumulator( 5.0 );
    // returns [ -5.0, 5.0 ]
    
    mm = accumulator();
    // returns [ -5.0, 5.0 ]