repl.txt (4827B)
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. 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 alternative indexing semantics. 75 76 While typed array views mandate a view offset based on the underlying 77 buffer, the `offset` parameter supports indexing semantics based on a 78 starting index. 79 80 Parameters 81 ---------- 82 N: integer 83 Number of indexed elements. 84 85 c: number 86 Degrees of freedom adjustment. Setting this parameter to a value other 87 than `0` has the effect of adjusting the divisor during the calculation 88 of the standard deviation according to `N - c` where `c` corresponds to 89 the provided degrees of freedom adjustment. When computing the standard 90 deviation of a population, setting this parameter to `0` is the standard 91 choice (i.e., the provided array contains data constituting an entire 92 population). When computing the corrected sample standard deviation, 93 setting this parameter to `1` is the standard choice (i.e., the provided 94 array contains data sampled from a larger population; this is commonly 95 referred to as Bessel's correction). 96 97 x: Float64Array 98 Input array. 99 100 strideX: integer 101 Index increment for `x`. 102 103 offsetX: integer 104 Starting index for `x`. 105 106 out: Float64Array 107 Output array. 108 109 strideOut: integer 110 Index increment for `out`. 111 112 offsetOut: integer 113 Starting index for `out`. 114 115 Returns 116 ------- 117 out: Float64Array 118 Output array. 119 120 Examples 121 -------- 122 // Standard Usage: 123 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 2.0 ] ); 124 > var out = new {{alias:@stdlib/array/float64}}( 2 ); 125 > {{alias}}.ndarray( x.length, 1, x, 1, 0, out, 1, 0 ) 126 <Float64Array>[ ~0.3333, ~2.0817 ] 127 128 // Using offset parameter: 129 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0 ] ); 130 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 131 > out = new {{alias:@stdlib/array/float64}}( 2 ); 132 > {{alias}}.ndarray( N, 1, x, 2, 1, out, 1, 0 ) 133 <Float64Array>[ ~0.3333, ~2.0817 ] 134 135 See Also 136 -------- 137