onesnd
Create an n-dimensional nested array filled with ones.
Usage
var onesnd = require( '@stdlib/array/base/onesnd' );
onesnd( shape )
Returns an n-dimensional nested array filled with ones.
var out = onesnd( [ 2, 3 ] );
// returns [ [ 1.0, 1.0, 1.0 ], [ 1.0, 1.0, 1.0 ] ]
Examples
var onesnd = require( '@stdlib/array/base/onesnd' );
var out = onesnd( [ 1, 3 ] );
// returns [ [ 1.0, 1.0, 1.0 ] ]
out = onesnd( [ 3, 1 ] );
// returns [ [ 1.0 ], [ 1.0 ], [ 1.0 ] ]
out = onesnd( [ 1, 1, 3 ] );
// returns [ [ [ 1.0, 1.0, 1.0 ] ] ]
out = onesnd( [ 1, 3, 1 ] );
// returns [ [ [ 1.0 ], [ 1.0 ], [ 1.0 ] ] ]
out = onesnd( [ 1, 1, 1, 3 ] );
// returns [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ]