{{alias}}( arrays, shape, strides, fcn, clbk[, thisArg] ) Applies a unary function to each element retrieved from a strided input array according to a callback function and assigns results to a strided output array. The shape and stride parameters determine which elements in the strided input and output arrays are accessed at runtime. Indexing is relative to the first index. To introduce an offset, use typed array views. The callback function is provided four arguments: - value: array element. - idx: iteration index. - indices: strided indices (offset + idx*stride). - arrays: input and output arrays. If the callback function does not return any value (or equivalently, explicitly returns `undefined`), the value is ignored. Parameters ---------- arrays: ArrayLikeObject Array-like object containing one strided input array and one strided output array. shape: ArrayLikeObject Array-like object containing a single element, the number of indexed elements. strides: ArrayLikeObject Array-like object containing the stride lengths for the strided input and output arrays. fcn: Function Unary function to apply to callback return values. clbk: Function Callback function. thisArg: any (optional) Callback execution context. Examples -------- // Standard usage: > var x = [ 1.0, -2.0, 3.0, -4.0 ]; > var y = [ 0.0, 0.0, 0.0, 0.0 ]; > var sh = [ x.length ]; > var st = [ 1, 1 ]; > function clbk( v ) { return v * 2.0; }; > {{alias}}( [ x, y ], sh, st, {{alias:@stdlib/math/base/special/abs}}, clbk ); > y [ 2.0, 4.0, 6.0, 8.0 ] // Using shape and stride parameters: > y = [ 0.0, 0.0, 0.0, 0.0 ]; > sh = [ 2 ]; > st = [ 2, -1 ]; > {{alias}}( [ x, y ], sh, st, {{alias:@stdlib/math/base/special/abs}}, clbk ); > y [ 6.0, 2.0, 0.0, 0.0 ] // Using view offsets: > var x0 = new {{alias:@stdlib/array/float64}}( [ 1.0, -2.0, 3.0, -4.0 ] ); > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] ); > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); > sh = [ 2 ]; > st = [ -2, 1 ]; > {{alias}}( [ x1, y1 ], sh, st, {{alias:@stdlib/math/base/special/abs}}, clbk ); > y1 [ 8.0, 4.0 ] > y0 [ 0.0, 0.0, 8.0, 4.0 ] {{alias}}.ndarray( arrays, shape, strides, offsets, fcn, clbk[, thisArg] ) Applies a unary function to each element retrieved from a strided input array according to a callback function and assigns results to a strided output array using alternative indexing semantics. While typed array views mandate a view offset based on the underlying buffer, the offsest parameters support indexing semantics based on starting indices. Parameters ---------- arrays: ArrayLikeObject Array-like object containing one strided input array and one strided output array. shape: ArrayLikeObject Array-like object containing a single element, the number of indexed elements. strides: ArrayLikeObject Array-like object containing the stride lengths for the strided input and output arrays. offsets: ArrayLikeObject Array-like object containing the starting indices (i.e., index offsets) for the strided input and output arrays. fcn: Function Unary function to apply to callback return values. clbk: Function Callback function. thisArg: any (optional) Callback execution context. Examples -------- // Standard usage: > var x = [ 1.0, -2.0, 3.0, -4.0 ]; > var y = [ 0.0, 0.0, 0.0, 0.0 ]; > var sh = [ x.length ]; > var st = [ 1, 1 ]; > var o = [ 0, 0 ]; > function clbk( v ) { return v * 2.0; }; > {{alias}}.ndarray( [ x, y ], sh, st, o, {{alias:@stdlib/math/base/special/abs}}, clbk ); > y [ 2.0, 4.0, 6.0, 8.0 ] // Advanced indexing: > x = [ 1.0, -2.0, 3.0, -4.0 ]; > y = [ 0.0, 0.0, 0.0, 0.0 ]; > sh = [ 2 ]; > st = [ 2, -1 ]; > o = [ 1, y.length-1 ]; > {{alias}}.ndarray( [ x, y ], sh, st, o, {{alias:@stdlib/math/base/special/abs}}, clbk ); > y [ 0.0, 0.0, 8.0, 4.0 ] See Also --------