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