time-to-botec

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

repl.txt (2578B)


      1 
      2 {{alias}}( N, x, stride )
      3     Computes the arithmetic mean of a single-precision floating-point strided
      4     array using a one-pass trial mean algorithm with pairwise summation.
      5 
      6     The `N` and `stride` parameters determine which elements in `x` are accessed
      7     at runtime.
      8 
      9     Indexing is relative to the first index. To introduce an offset, use a typed
     10     array view.
     11 
     12     If `N <= 0`, the function returns `NaN`.
     13 
     14     Parameters
     15     ----------
     16     N: integer
     17         Number of indexed elements.
     18 
     19     x: Float32Array
     20         Input array.
     21 
     22     stride: integer
     23         Index increment.
     24 
     25     Returns
     26     -------
     27     out: number
     28         The arithmetic mean.
     29 
     30     Examples
     31     --------
     32     // Standard Usage:
     33     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     34     > {{alias}}( x.length, x, 1 )
     35     ~0.3333
     36 
     37     // Using `N` and `stride` parameters:
     38     > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
     39     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     40     > var stride = 2;
     41     > {{alias}}( N, x, stride )
     42     ~0.3333
     43 
     44     // Using view offsets:
     45     > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     46     > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     47     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     48     > stride = 2;
     49     > {{alias}}( N, x1, stride )
     50     ~-0.3333
     51 
     52 {{alias}}.ndarray( N, x, stride, offset )
     53     Computes the arithmetic mean of a single-precision floating-point strided
     54     array using a one-pass trial mean algorithm with pairwise summation and
     55     alternative indexing semantics.
     56 
     57     While typed array views mandate a view offset based on the underlying
     58     buffer, the `offset` parameter supports indexing semantics based on a
     59     starting index.
     60 
     61     Parameters
     62     ----------
     63     N: integer
     64         Number of indexed elements.
     65 
     66     x: Float32Array
     67         Input array.
     68 
     69     stride: integer
     70         Index increment.
     71 
     72     offset: integer
     73         Starting index.
     74 
     75     Returns
     76     -------
     77     out: number
     78         The arithmetic mean.
     79 
     80     Examples
     81     --------
     82     // Standard Usage:
     83     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     84     > {{alias}}.ndarray( x.length, x, 1, 0 )
     85     ~0.3333
     86 
     87     // Using offset parameter:
     88     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     89     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     90     > {{alias}}.ndarray( N, x, 2, 1 )
     91     ~-0.3333
     92 
     93     See Also
     94     --------
     95