repl.txt (3160B)
1 2 {{alias}}( arrays, shape, strides, fcn ) 3 Applies a ternary 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 three 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 Ternary 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}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 35 > var shape = [ x.length ]; 36 > var strides = [ 1, 1, 1, 1 ]; 37 > function f( x, y, z ) { return x + y + z; }; 38 > {{alias}}( [ x, y, z, w ], shape, strides, f ); 39 > w 40 <Float64Array>[ 3.0, 6.0, 9.0, 12.0 ] 41 42 43 {{alias}}.ndarray( arrays, shape, strides, offsets, fcn ) 44 Applies a ternary callback to strided input array elements and assigns 45 results to elements in a strided output array using alternative indexing 46 semantics. 47 48 While typed array views mandate a view offset based on the underlying 49 buffer, the `offsets` parameter supports indexing semantics based on 50 starting indices. 51 52 Parameters 53 ---------- 54 arrays: ArrayLikeObject<ArrayLikeObject> 55 Array-like object containing three strided input arrays and one strided 56 output array. 57 58 shape: ArrayLikeObject<integer> 59 Array-like object containing a single element, the number of indexed 60 elements. 61 62 strides: ArrayLikeObject<integer> 63 Array-like object containing the stride lengths for the strided input 64 and output arrays. 65 66 offsets: ArrayLikeObject<integer> 67 Array-like object containing the starting indices (i.e., index offsets) 68 for the strided input and output arrays. 69 70 fcn: Function 71 Ternary callback. 72 73 Examples 74 -------- 75 > var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 76 > var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 77 > var z = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] ); 78 > var w = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); 79 > var shape = [ x.length ]; 80 > var strides = [ 1, 1, 1, 1 ]; 81 > var offsets = [ 0, 0, 0, 0 ]; 82 > function f( x, y, z ) { return x + y + z; }; 83 > {{alias}}.ndarray( [ x, y, z, w ], shape, strides, offsets, f ); 84 > w 85 <Float64Array>[ 3.0, 6.0, 9.0, 12.0 ] 86 87 See Also 88 -------- 89