time-to-botec

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

repl.txt (4187B)


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