time-to-botec

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

repl.txt (4729B)


      1 
      2 {{alias}}( N, c, x, strideX, out, strideOut )
      3     Computes the mean and variance of a double-precision floating-point strided
      4     array.
      5 
      6     The `N` and `stride` parameters determine which elements are accessed at
      7     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 a mean and variance equal to `NaN`.
     13 
     14     Parameters
     15     ----------
     16     N: integer
     17         Number of indexed elements.
     18 
     19     c: number
     20         Degrees of freedom adjustment. Setting this parameter to a value other
     21         than `0` has the effect of adjusting the divisor during the calculation
     22         of the variance according to `N - c` where `c` corresponds to the
     23         provided degrees of freedom adjustment. When computing the variance of a
     24         population, setting this parameter to `0` is the standard choice (i.e.,
     25         the provided array contains data constituting an entire population).
     26         When computing the unbiased sample variance, setting this parameter to
     27         `1` is the standard choice (i.e., the provided array contains data
     28         sampled from a larger population; this is commonly referred to as
     29         Bessel's correction).
     30 
     31     x: Float64Array
     32         Input array.
     33 
     34     strideX: integer
     35         Index increment for `x`.
     36 
     37     out: Float64Array
     38         Output array.
     39 
     40     strideOut: integer
     41         Index increment for `out`.
     42 
     43     Returns
     44     -------
     45     out: Float64Array
     46         Output array.
     47 
     48     Examples
     49     --------
     50     // Standard Usage:
     51     > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] );
     52     > var out = new {{alias:@stdlib/array/float64}}( 2 );
     53     > {{alias}}( x.length, 1, x, 1, out, 1 )
     54     <Float64Array>[ ~0.3333, ~4.3333 ]
     55 
     56     // Using `N` and `stride` parameters:
     57     > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
     58     > out = new {{alias:@stdlib/array/float64}}( 2 );
     59     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     60     > {{alias}}( N, 1, x, 2, out, 1 )
     61     <Float64Array>[ ~0.3333, ~4.3333 ]
     62 
     63     // Using view offsets:
     64     > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
     65     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     66     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     67     > out = new {{alias:@stdlib/array/float64}}( 2 );
     68     > {{alias}}( N, 1, x1, 2, out, 1 )
     69     <Float64Array>[ ~0.3333, ~4.3333 ]
     70 
     71 {{alias}}.ndarray( N, c, x, strideX, offsetX, out, strideOut, offsetOut )
     72     Computes the mean and variance of a double-precision floating-point strided
     73     array using alternative indexing semantics.
     74 
     75     While typed array views mandate a view offset based on the underlying
     76     buffer, the `offset` parameter supports indexing semantics based on a
     77     starting index.
     78 
     79     Parameters
     80     ----------
     81     N: integer
     82         Number of indexed elements.
     83 
     84     c: number
     85         Degrees of freedom adjustment. Setting this parameter to a value other
     86         than `0` has the effect of adjusting the divisor during the calculation
     87         of the variance according to `N - c` where `c` corresponds to the
     88         provided degrees of freedom adjustment. When computing the variance of a
     89         population, setting this parameter to `0` is the standard choice (i.e.,
     90         the provided array contains data constituting an entire population).
     91         When computing the unbiased sample variance, setting this parameter to
     92         `1` is the standard choice (i.e., the provided array contains data
     93         sampled from a larger population; this is commonly referred to as
     94         Bessel's correction).
     95 
     96     x: Float64Array
     97         Input array.
     98 
     99     strideX: integer
    100         Index increment for `x`.
    101 
    102     offsetX: integer
    103         Starting index for `x`.
    104 
    105     out: Float64Array
    106         Output array.
    107 
    108     strideOut: integer
    109         Index increment for `out`.
    110 
    111     offsetOut: integer
    112         Starting index for `out`.
    113 
    114     Returns
    115     -------
    116     out: Float64Array
    117         Output array.
    118 
    119     Examples
    120     --------
    121     // Standard Usage:
    122     > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] );
    123     > var out = new {{alias:@stdlib/array/float64}}( 2 );
    124     > {{alias}}.ndarray( x.length, 1, x, 1, 0, out, 1, 0 )
    125     <Float64Array>[ ~0.3333, ~4.3333 ]
    126 
    127     // Using offset parameter:
    128     > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
    129     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    130     > out = new {{alias:@stdlib/array/float64}}( 2 );
    131     > {{alias}}.ndarray( N, 1, x, 2, 1, out, 1, 0 )
    132     <Float64Array>[ ~0.3333, ~4.3333 ]
    133 
    134     See Also
    135     --------
    136