repl.txt (3516B)
1 2 {{alias}}( N, x, strideX, y, strideY ) 3 Computes the cube root of each element in a single-precision floating-point 4 strided array `x` and assigns the results to elements in a single-precision 5 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}}( [ 0.0, 1.0, 8.0, 27.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>[ 0.0, 1.0, 2.0, 3.0 ] 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>[ 2.0, 0.0, 0.0, 0.0 ] 48 49 // Using view offsets: 50 > var x0 = new {{alias:@stdlib/array/float32}}( [ 0.0, 1.0, 8.0, 27.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>[ 3.0, 1.0 ] 57 > y0 58 <Float32Array>[ 0.0, 0.0, 3.0, 1.0 ] 59 60 61 {{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) 62 Computes the cube root of each element in a single-precision floating-point 63 strided array `x` and assigns the results to elements in a single-precision 64 floating-point strided array `y` using alternative indexing semantics. 65 66 While typed array views mandate a view offset based on the underlying 67 buffer, the `offsetX` and `offsetY` parameters support indexing semantics 68 based on starting indices. 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 y: Float32Array 85 Destination array. 86 87 strideY: integer 88 Index increment for `y`. 89 90 offsetY: integer 91 Starting index for `y`. 92 93 Returns 94 ------- 95 y: Float32Array 96 Input array `y`. 97 98 Examples 99 -------- 100 // Standard usage: 101 > var x = new {{alias:@stdlib/array/float32}}( [ 0.0, 1.0, 8.0, 27.0 ] ); 102 > var y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 103 > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) 104 <Float32Array>[ 0.0, 1.0, 2.0, 3.0 ] 105 106 // Advanced indexing: 107 > x = new {{alias:@stdlib/array/float32}}( [ 0.0, 1.0, 8.0, 27.0 ] ); 108 > y = new {{alias:@stdlib/array/float32}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 109 > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); 110 > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) 111 <Float32Array>[ 0.0, 0.0, 3.0, 1.0 ] 112 113 See Also 114 -------- 115