repl.txt (3568B)
1 2 {{alias}}( N, x, strideX, y, strideY ) 3 Computes the reciprocal square root for each element in a single-precision 4 floating-point strided array `x` and assigns the results to elements in a 5 single-precision floating-point strided array `y`. 6 7 The `N` and `stride` parameters determine which elements in `x` and `y` are 8 accessed at runtime. 9 10 Indexing is relative to the first index. To introduce an offset, use typed 11 array views. 12 13 Parameters 14 ---------- 15 N: integer 16 Number of indexed elements. 17 18 x: Float32Array 19 Input array. 20 21 strideX: integer 22 Index increment for `x`. 23 24 y: Float32Array 25 Destination array. 26 27 strideY: integer 28 Index increment for `y`. 29 30 Returns 31 ------- 32 y: Float32Array 33 Input array `y`. 34 35 Examples 36 -------- 37 // Standard usage: 38 > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 4.0, 9.0, 12.0 ] ); 39 > var y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 40 > {{alias}}( x.length, x, 1, y, 1 ) 41 <Float32Array>[ 1.0, 0.5, ~0.333, ~0.289 ] 42 43 // Using `N` and `stride` parameters: 44 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 45 > y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 46 > {{alias}}( N, x, 2, y, -1 ) 47 <Float32Array>[ ~0.333, 1.0, 0.0, 0.0 ] 48 49 // Using view offsets: 50 > var x0 = new {{alias:@stdlib/array/float32}}( [ 1.0, 4.0, 9.0, 12.0 ] ); 51 > var y0 = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 52 > var x1 = new {{alias:@stdlib/array/float32}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); 53 > var y1 = new {{alias:@stdlib/array/float32}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); 54 > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); 55 > {{alias}}( N, x1, -2, y1, 1 ) 56 <Float32Array>[ ~0.289, 0.5 ] 57 > y0 58 <Float32Array>[ 0.0, 0.0, ~0.289, 0.5 ] 59 60 61 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) 62 Computes the reciprocal square root for each element in a single-precision 63 floating-point strided array `x` and assigns the results to elements in a 64 single-precision floating-point strided array `y` using alternative indexing 65 semantics. 66 67 While typed array views mandate a view offset based on the underlying 68 buffer, the `offsetX` and `offsetY` parameters support indexing semantics 69 based on starting indices. 70 71 Parameters 72 ---------- 73 N: integer 74 Number of indexed elements. 75 76 x: Float32Array 77 Input array. 78 79 strideX: integer 80 Index increment for `x`. 81 82 offsetX: integer 83 Starting index for `x`. 84 85 y: Float32Array 86 Destination array. 87 88 strideY: integer 89 Index increment for `y`. 90 91 offsetY: integer 92 Starting index for `y`. 93 94 Returns 95 ------- 96 y: Float32Array 97 Input array `y`. 98 99 Examples 100 -------- 101 // Standard usage: 102 > var x = new {{alias:@stdlib/array/float32}}( [ 1.0, 4.0, 9.0, 12.0 ] ); 103 > var y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 104 > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) 105 <Float32Array>[ 1.0, 0.5, ~0.333, ~0.289 ] 106 107 // Advanced indexing: 108 > x = new {{alias:@stdlib/array/float32}}( [ 1.0, 4.0, 9.0, 12.0 ] ); 109 > y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 110 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 111 > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) 112 <Float32Array>[ 0.0, 0.0, ~0.289, 0.5 ] 113 114 See Also 115 -------- 116