repl.txt (3355B)
1 2 {{alias}}( arrays, shape, strides, fcn ) 3 Applies a quaternary callback to strided input array elements and assigns 4 results to elements in a strided output array. 5 6 The `shape` and `strides` parameters determine which elements in the strided 7 input and output arrays are accessed at runtime. 8 9 Indexing is relative to the first index. To introduce an offset, use typed 10 array views. 11 12 Parameters 13 ---------- 14 arrays: ArrayLikeObject<ArrayLikeObject> 15 Array-like object containing four strided input arrays and one strided 16 output array. 17 18 shape: ArrayLikeObject<integer> 19 Array-like object containing a single element, the number of indexed 20 elements. 21 22 strides: ArrayLikeObject<integer> 23 Array-like object containing the stride lengths for the strided input 24 and output arrays. 25 26 fcn: Function 27 Quaternary callback. 28 29 Examples 30 -------- 31 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 32 > var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 33 > var z = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 34 > var w = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 35 > var u = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 36 > var shape = [ x.length ]; 37 > var strides = [ 1, 1, 1, 1, 1 ]; 38 > function f( x, y, z, w ) { return x + y + z + w; }; 39 > {{alias}}( [ x, y, z, w, u ], shape, strides, f ); 40 > u 41 <Float64Array>[ 4.0, 8.0, 12.0, 16.0 ] 42 43 44 {{alias}}.ndarray( arrays, shape, strides, offsets, fcn ) 45 Applies a quaternary callback to strided input array elements and assigns 46 results to elements in a strided output array using alternative indexing 47 semantics. 48 49 While typed array views mandate a view offset based on the underlying 50 buffer, the `offsets` parameter supports indexing semantics based on 51 starting indices. 52 53 Parameters 54 ---------- 55 arrays: ArrayLikeObject<ArrayLikeObject> 56 Array-like object containing four strided input arrays and one strided 57 output array. 58 59 shape: ArrayLikeObject<integer> 60 Array-like object containing a single element, the number of indexed 61 elements. 62 63 strides: ArrayLikeObject<integer> 64 Array-like object containing the stride lengths for the strided input 65 and output arrays. 66 67 offsets: ArrayLikeObject<integer> 68 Array-like object containing the starting indices (i.e., index offsets) 69 for the strided input and output arrays. 70 71 fcn: Function 72 Quaternary callback. 73 74 Examples 75 -------- 76 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 77 > var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 78 > var z = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 79 > var w = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 80 > var u = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 81 > var shape = [ x.length ]; 82 > var strides = [ 1, 1, 1, 1, 1 ]; 83 > var offsets = [ 0, 0, 0, 0, 0 ]; 84 > function f( x, y, z, w ) { return x + y + z + w; }; 85 > {{alias}}.ndarray( [ x, y, z, w, u ], shape, strides, offsets, f ); 86 > u 87 <Float64Array>[ 4.0, 8.0, 12.0, 16.0 ] 88 89 See Also 90 -------- 91