92 lines
3.3 KiB
Plaintext
92 lines
3.3 KiB
Plaintext
|
|
||
|
{{alias}}( arrays, shape, strides, fcn )
|
||
|
Applies a quaternary callback to strided input array elements and assigns
|
||
|
results to elements in a strided output array.
|
||
|
|
||
|
The `shape` and `strides` 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.
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
arrays: ArrayLikeObject<ArrayLikeObject>
|
||
|
Array-like object containing four strided input arrays and one strided
|
||
|
output array.
|
||
|
|
||
|
shape: ArrayLikeObject<integer>
|
||
|
Array-like object containing a single element, the number of indexed
|
||
|
elements.
|
||
|
|
||
|
strides: ArrayLikeObject<integer>
|
||
|
Array-like object containing the stride lengths for the strided input
|
||
|
and output arrays.
|
||
|
|
||
|
fcn: Function
|
||
|
Quaternary callback.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var z = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var w = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var u = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
||
|
> var shape = [ x.length ];
|
||
|
> var strides = [ 1, 1, 1, 1, 1 ];
|
||
|
> function f( x, y, z, w ) { return x + y + z + w; };
|
||
|
> {{alias}}( [ x, y, z, w, u ], shape, strides, f );
|
||
|
> u
|
||
|
<Float64Array>[ 4.0, 8.0, 12.0, 16.0 ]
|
||
|
|
||
|
|
||
|
{{alias}}.ndarray( arrays, shape, strides, offsets, fcn )
|
||
|
Applies a quaternary callback to strided input array elements and assigns
|
||
|
results to elements in a strided output array using alternative indexing
|
||
|
semantics.
|
||
|
|
||
|
While typed array views mandate a view offset based on the underlying
|
||
|
buffer, the `offsets` parameter supports indexing semantics based on
|
||
|
starting indices.
|
||
|
|
||
|
Parameters
|
||
|
----------
|
||
|
arrays: ArrayLikeObject<ArrayLikeObject>
|
||
|
Array-like object containing four strided input arrays and one strided
|
||
|
output array.
|
||
|
|
||
|
shape: ArrayLikeObject<integer>
|
||
|
Array-like object containing a single element, the number of indexed
|
||
|
elements.
|
||
|
|
||
|
strides: ArrayLikeObject<integer>
|
||
|
Array-like object containing the stride lengths for the strided input
|
||
|
and output arrays.
|
||
|
|
||
|
offsets: ArrayLikeObject<integer>
|
||
|
Array-like object containing the starting indices (i.e., index offsets)
|
||
|
for the strided input and output arrays.
|
||
|
|
||
|
fcn: Function
|
||
|
Quaternary callback.
|
||
|
|
||
|
Examples
|
||
|
--------
|
||
|
> var x = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var y = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var z = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var w = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
|
||
|
> var u = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
||
|
> var shape = [ x.length ];
|
||
|
> var strides = [ 1, 1, 1, 1, 1 ];
|
||
|
> var offsets = [ 0, 0, 0, 0, 0 ];
|
||
|
> function f( x, y, z, w ) { return x + y + z + w; };
|
||
|
> {{alias}}.ndarray( [ x, y, z, w, u ], shape, strides, offsets, f );
|
||
|
> u
|
||
|
<Float64Array>[ 4.0, 8.0, 12.0, 16.0 ]
|
||
|
|
||
|
See Also
|
||
|
--------
|
||
|
|