time-to-botec

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

repl.txt (4319B)


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