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