time-to-botec

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

repl.txt (4167B)


      1 
      2 {{alias}}( N, correction, x, stride )
      3     Computes the variance of a single-precision floating-point strided array
      4     using a two-pass algorithm with extended accumulation and returning an
      5     extended precision result.
      6 
      7     The `N` and `stride` parameters determine which elements in `x` are accessed
      8     at runtime.
      9 
     10     Indexing is relative to the first index. To introduce an offset, use a typed
     11     array view.
     12 
     13     If `N <= 0`, the function returns `NaN`.
     14 
     15     Parameters
     16     ----------
     17     N: integer
     18         Number of indexed elements.
     19 
     20     correction: number
     21         Degrees of freedom adjustment. Setting this parameter to a value other
     22         than `0` has the effect of adjusting the divisor during the calculation
     23         of the variance according to `N - c` where `c` corresponds to the
     24         provided degrees of freedom adjustment. When computing the variance of a
     25         population, setting this parameter to `0` is the standard choice (i.e.,
     26         the provided array contains data constituting an entire population).
     27         When computing the unbiased sample variance, setting this parameter to
     28         `1` is the standard choice (i.e., the provided array contains data
     29         sampled from a larger population; this is commonly referred to as
     30         Bessel's correction).
     31 
     32     x: Float32Array
     33         Input array.
     34 
     35     stride: integer
     36         Index increment.
     37 
     38     Returns
     39     -------
     40     out: number
     41         The variance.
     42 
     43     Examples
     44     --------
     45     // Standard Usage:
     46     > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 2.0 ] );
     47     > {{alias}}( x.length, 1, x, 1 )
     48     ~4.3333
     49 
     50     // Using `N` and `stride` parameters:
     51     > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] );
     52     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
     53     > var stride = 2;
     54     > {{alias}}( N, 1, x, stride )
     55     ~4.3333
     56 
     57     // Using view offsets:
     58     > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] );
     59     > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     60     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     61     > stride = 2;
     62     > {{alias}}( N, 1, x1, stride )
     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     using a two-pass algorithm with extended accumulation and alternative
     68     indexing semantics and returning an extended precision result.
     69 
     70     While typed array views mandate a view offset based on the underlying
     71     buffer, the `offset` parameter supports indexing semantics based on a
     72     starting index.
     73 
     74     Parameters
     75     ----------
     76     N: integer
     77         Number of indexed elements.
     78 
     79     correction: number
     80         Degrees of freedom adjustment. Setting this parameter to a value other
     81         than `0` has the effect of adjusting the divisor during the calculation
     82         of the variance according to `N - c` where `c` corresponds to the
     83         provided degrees of freedom adjustment. 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, 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