repl.txt (4185B)
1 2 {{alias}}( N, correction, x, stride ) 3 Computes the standard deviation of a double-precision floating-point strided 4 array using a one-pass algorithm proposed by Youngs and Cramer. 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 correction: number 20 Degrees of freedom adjustment. Setting this parameter to a value other 21 than `0` has the effect of adjusting the divisor during the calculation 22 of the standard deviation according to `N - c` where `c` corresponds to 23 the provided degrees of freedom adjustment. When computing the standard 24 deviation of a population, setting this parameter to `0` is the standard 25 choice (i.e., the provided array contains data constituting an entire 26 population). When computing the corrected sample standard deviation, 27 setting this parameter to `1` is the standard choice (i.e., the provided 28 array contains data sampled from a larger population; this is commonly 29 referred to as Bessel's correction). 30 31 x: Float64Array 32 Input array. 33 34 stride: integer 35 Index increment. 36 37 Returns 38 ------- 39 out: number 40 The standard deviation. 41 42 Examples 43 -------- 44 // Standard Usage: 45 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] ); 46 > {{alias}}( x.length, 1, x, 1 ) 47 ~2.0817 48 49 // Using `N` and `stride` parameters: 50 > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); 51 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 52 > var stride = 2; 53 > {{alias}}( N, 1, x, stride ) 54 ~2.0817 55 56 // Using view offsets: 57 > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); 58 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 59 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 60 > stride = 2; 61 > {{alias}}( N, 1, x1, stride ) 62 ~2.0817 63 64 {{alias}}.ndarray( N, correction, x, stride, offset ) 65 Computes the standard deviation of a double-precision floating-point strided 66 array using a one-pass algorithm proposed by Youngs and Cramer and 67 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 standard deviation according to `N - c` where `c` corresponds to 82 the provided degrees of freedom adjustment. When computing the standard 83 deviation of a population, setting this parameter to `0` is the standard 84 choice (i.e., the provided array contains data constituting an entire 85 population). When computing the corrected sample standard deviation, 86 setting this parameter to `1` is the standard choice (i.e., the provided 87 array contains data sampled from a larger population; this is commonly 88 referred to as Bessel's correction). 89 90 x: Float64Array 91 Input array. 92 93 stride: integer 94 Index increment. 95 96 offset: integer 97 Starting index. 98 99 Returns 100 ------- 101 out: number 102 The standard deviation. 103 104 Examples 105 -------- 106 // Standard Usage: 107 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] ); 108 > {{alias}}.ndarray( x.length, 1, x, 1, 0 ) 109 ~2.0817 110 111 // Using offset parameter: 112 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, -1.0 ] ); 113 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 114 > {{alias}}.ndarray( N, 1, x, 2, 1 ) 115 ~2.0817 116 117 See Also 118 -------- 119