time-to-botec

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

repl.txt (4160B)


      1 
      2 {{alias}}( N, mean, correction, x, stride )
      3     Computes the variance of a double-precision floating-point strided array
      4     provided a known mean and using Neely's correction algorithm.
      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     mean: number
     20         Mean.
     21 
     22     correction: number
     23         Degrees of freedom adjustment. Setting this parameter to a value other
     24         than `0` has the effect of adjusting the divisor during the calculation
     25         of the variance according to `N - c` where `c` corresponds to the
     26         provided degrees of freedom adjustment. 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: Float64Array
     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/float64}}( [ 1.0, -2.0, 2.0 ] );
     49     > {{alias}}( x.length, 1.0/3.0, 1, x, 1 )
     50     ~4.3333
     51 
     52     // Using `N` and `stride` parameters:
     53     > x = new {{alias:@stdlib/array/float64}}( [ -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.0/3.0, 1, x, 2 )
     56     ~4.3333
     57 
     58     // Using view offsets:
     59     > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
     60     > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
     61     > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 );
     62     > {{alias}}( N, 1.0/3.0, 1, x1, 2 )
     63     ~4.3333
     64 
     65 {{alias}}.ndarray( N, mean, correction, x, stride, offset )
     66     Computes the variance of a double-precision floating-point strided array
     67     provided a known mean and using Neely's correction algorithm and alternative
     68     indexing semantics.
     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     mean: number
     80         Mean.
     81 
     82     correction: number
     83         Degrees of freedom adjustment. Setting this parameter to a value other
     84         than `0` has the effect of adjusting the divisor during the calculation
     85         of the variance according to `N - c` where `c` corresponds to the
     86         provided degrees of freedom adjustment. When computing the variance of a
     87         population, setting this parameter to `0` is the standard choice (i.e.,
     88         the provided array contains data constituting an entire population).
     89         When computing the unbiased sample variance, setting this parameter to
     90         `1` is the standard choice (i.e., the provided array contains data
     91         sampled from a larger population; this is commonly referred to as
     92         Bessel's correction).
     93 
     94     x: Float64Array
     95         Input array.
     96 
     97     stride: integer
     98         Index increment.
     99 
    100     offset: integer
    101         Starting index.
    102 
    103     Returns
    104     -------
    105     out: number
    106         The variance.
    107 
    108     Examples
    109     --------
    110     // Standard Usage:
    111     > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] );
    112     > {{alias}}.ndarray( x.length, 1.0/3.0, 1, x, 1, 0 )
    113     ~4.3333
    114 
    115     // Using offset parameter:
    116     > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] );
    117     > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 );
    118     > {{alias}}.ndarray( N, 1.0/3.0, 1, x, 2, 1 )
    119     ~4.3333
    120 
    121     See Also
    122     --------
    123