repl.txt (3603B)
1 2 {{alias}}( N, x, strideX, out, strideOut ) 3 Computes the sum of single-precision floating-point strided array elements, 4 ignoring `NaN` values, using ordinary recursive summation with extended 5 accumulation, and returning an extended precision result. 6 7 The `N` and `stride` parameters determine which elements are accessed at 8 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 a sum equal to `0.0`. 14 15 Parameters 16 ---------- 17 N: integer 18 Number of indexed elements. 19 20 x: Float32Array 21 Input array. 22 23 strideX: integer 24 Index increment for `x`. 25 26 out: Float64Array 27 Output array. 28 29 strideOut: integer 30 Index increment for `out`. 31 32 Returns 33 ------- 34 out: Float64Array 35 Output array whose first element is the sum and whose second element is 36 the number of non-NaN elements. 37 38 Examples 39 -------- 40 // Standard Usage: 41 > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, NaN, 2.0 ] ); 42 > var out = new {{alias:@stdlib/array/float64}}( 2 ); 43 > {{alias}}( x.length, x, 1, out, 1 ) 44 <Float64Array>[ 1.0, 3 ] 45 46 // Using `N` and `stride` parameters: 47 > x = new {{alias:@stdlib/array/float32}}( [ -2.0, 1.0, 1.0, -5.0, 2.0, -1.0, NaN, NaN ] ); 48 > out = new {{alias:@stdlib/array/float64}}( 2 ); 49 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 50 > {{alias}}( N, x, 2, out, 1 ) 51 <Float64Array>[ 1.0, 3 ] 52 53 // Using view offsets: 54 > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0, NaN, NaN ] ); 55 > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 56 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 57 > out = new {{alias:@stdlib/array/float64}}( 2 ); 58 > {{alias}}( N, x1, 2, out, 1 ) 59 <Float64Array>[ 1.0, 3 ] 60 61 {{alias}}.ndarray( N, x, strideX, offsetX, out, strideOut, offsetOut ) 62 Computes the sum of single-precision floating-point strided array elements, 63 ignoring `NaN` values and using ordinary recursive summation with extended 64 accumulation and alternative indexing semantics. 65 66 While typed array views mandate a view offset based on the underlying 67 buffer, the `offset` parameter supports indexing semantics based on a 68 starting index. 69 70 Parameters 71 ---------- 72 N: integer 73 Number of indexed elements. 74 75 x: Float32Array 76 Input array. 77 78 strideX: integer 79 Index increment for `x`. 80 81 offsetX: integer 82 Starting index for `x`. 83 84 out: Float64Array 85 Output array. 86 87 strideOut: integer 88 Index increment for `out`. 89 90 offsetOut: integer 91 Starting index for `out`. 92 93 Returns 94 ------- 95 out: Float64Array 96 Output array whose first element is the sum and whose second element is 97 the number of non-NaN elements. 98 99 Examples 100 -------- 101 // Standard Usage: 102 > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, NaN, 2.0 ] ); 103 > var out = new {{alias:@stdlib/array/float64}}( 2 ); 104 > {{alias}}.ndarray( x.length, x, 1, 0, out, 1, 0 ) 105 <Float64Array>[ 1.0, 3 ] 106 107 // Using offset parameter: 108 > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, -2.0, 3.0, 2.0, 5.0, 1.0, NaN, NaN ] ); 109 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 110 > out = new {{alias:@stdlib/array/float64}}( 2 ); 111 > {{alias}}.ndarray( N, x, 2, 1, out, 1, 0 ) 112 <Float64Array>[ 1.0, 3 ] 113 114 See Also 115 -------- 116