repl.txt (4883B)
1 2 {{alias}}( N, c, x, strideX, out, strideOut ) 3 Computes the mean and standard deviation of a double-precision floating- 4 point strided array using a two-pass algorithm. 5 6 The `N` and `stride` parameters determine which elements are accessed at 7 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 a mean and standard deviation equal to 13 `NaN`. 14 15 Parameters 16 ---------- 17 N: integer 18 Number of indexed elements. 19 20 c: 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 standard deviation according to `N - c` where `c` corresponds to 24 the provided degrees of freedom adjustment. When computing the standard 25 deviation of a population, setting this parameter to `0` is the standard 26 choice (i.e., the provided array contains data constituting an entire 27 population). When computing the corrected sample standard deviation, 28 setting this parameter to `1` is the standard choice (i.e., the provided 29 array contains data sampled from a larger population; this is commonly 30 referred to as Bessel's correction). 31 32 x: Float64Array 33 Input array. 34 35 strideX: integer 36 Index increment for `x`. 37 38 out: Float64Array 39 Output array. 40 41 strideOut: integer 42 Index increment for `out`. 43 44 Returns 45 ------- 46 out: Float64Array 47 Output array. 48 49 Examples 50 -------- 51 // Standard Usage: 52 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] ); 53 > var out = new {{alias:@stdlib/array/float64}}( 2 ); 54 > {{alias}}( x.length, 1, x, 1, out, 1 ) 55 <Float64Array>[ ~0.3333, ~2.0817 ] 56 57 // Using `N` and `stride` parameters: 58 > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0 ] ); 59 > out = new {{alias:@stdlib/array/float64}}( 2 ); 60 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 61 > {{alias}}( N, 1, x, 2, out, 1 ) 62 <Float64Array>[ ~0.3333, ~2.0817 ] 63 64 // Using view offsets: 65 > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] ); 66 > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 67 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 68 > out = new {{alias:@stdlib/array/float64}}( 2 ); 69 > {{alias}}( N, 1, x1, 2, out, 1 ) 70 <Float64Array>[ ~0.3333, ~2.0817 ] 71 72 {{alias}}.ndarray( N, c, x, strideX, offsetX, out, strideOut, offsetOut ) 73 Computes the mean and standard deviation of a double-precision floating- 74 point strided array using a two-pass algorithm and alternative indexing 75 semantics. 76 77 While typed array views mandate a view offset based on the underlying 78 buffer, the `offset` parameter supports indexing semantics based on a 79 starting index. 80 81 Parameters 82 ---------- 83 N: integer 84 Number of indexed elements. 85 86 c: number 87 Degrees of freedom adjustment. Setting this parameter to a value other 88 than `0` has the effect of adjusting the divisor during the calculation 89 of the standard deviation according to `N - c` where `c` corresponds to 90 the provided degrees of freedom adjustment. When computing the standard 91 deviation of a population, setting this parameter to `0` is the standard 92 choice (i.e., the provided array contains data constituting an entire 93 population). When computing the corrected sample standard deviation, 94 setting this parameter to `1` is the standard choice (i.e., the provided 95 array contains data sampled from a larger population; this is commonly 96 referred to as Bessel's correction). 97 98 x: Float64Array 99 Input array. 100 101 strideX: integer 102 Index increment for `x`. 103 104 offsetX: integer 105 Starting index for `x`. 106 107 out: Float64Array 108 Output array. 109 110 strideOut: integer 111 Index increment for `out`. 112 113 offsetOut: integer 114 Starting index for `out`. 115 116 Returns 117 ------- 118 out: Float64Array 119 Output array. 120 121 Examples 122 -------- 123 // Standard Usage: 124 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] ); 125 > var out = new {{alias:@stdlib/array/float64}}( 2 ); 126 > {{alias}}.ndarray( x.length, 1, x, 1, 0, out, 1, 0 ) 127 <Float64Array>[ ~0.3333, ~2.0817 ] 128 129 // Using offset parameter: 130 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] ); 131 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 132 > out = new {{alias:@stdlib/array/float64}}( 2 ); 133 > {{alias}}.ndarray( N, 1, x, 2, 1, out, 1, 0 ) 134 <Float64Array>[ ~0.3333, ~2.0817 ] 135 136 See Also 137 -------- 138