@stdlib/array
Version:
Arrays.
72 lines (53 loc) • 1.68 kB
Plain Text
{{alias}}( x, shape, fcn[, thisArg] )
Applies a function to elements in a three-dimensional nested input array and
assigns results to elements in a new three-dimensional nested output array.
Parameters
----------
x: ArrayLikeObject
Input nested array.
shape: Array<integer>
Array shape.
fcn: Function
Function to apply.
thisArg: any (optional)
Function execution context.
Returns
-------
out: Array<Array>
Output nested array.
Examples
--------
> var x = [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ];
> var shape = [ 1, 2, 2 ];
> var y = {{alias}}( x, shape, {{alias: /math/base/special/abs}} )
[ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ]
{{alias}}.assign( x, y, shape, fcn[, thisArg] )
Applies a function to elements in a three-dimensional nested input array and
assigns results to elements in a three-dimensional nested output array.
Parameters
----------
x: ArrayLikeObject
Input nested array.
y: ArrayLikeObject
Output nested array.
shape: Array<integer>
Array shape.
fcn: Function
Function to apply.
thisArg: any (optional)
Function execution context.
Returns
-------
out: ArrayLikeObject
Output nested array.
Examples
--------
> var x = [ [ [ -1.0, -2.0 ], [ -3.0, -4.0 ] ] ];
> var y = [ [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ];
> var shape = [ 1, 2, 2 ];
> var out = {{alias}}.assign( x, y, shape, {{alias: /math/base/special/abs}} )
[ [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ]
> var b = ( out === y )
true
See Also
--------