time-to-botec

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

repl.txt (3869B)


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