ones3d

Create a three-dimensional nested array filled with ones.

Usage

var ones3d = require( '@stdlib/array/base/ones3d' );

ones3d( shape )

Returns a three-dimensional nested array filled with ones.

var out = ones3d( [ 1, 2, 3 ] );
// returns [ [ [ 1.0, 1.0, 1.0 ], [ 1.0, 1.0, 1.0 ] ] ]

Examples

var ones3d = require( '@stdlib/array/base/ones3d' );

var out = ones3d( [ 1, 1, 3 ] );
// returns [ [ [ 1.0, 1.0, 1.0 ] ] ]

out = ones3d( [ 1, 3, 1 ] );
// returns [ [ [ 1.0 ], [ 1.0 ], [ 1.0 ] ] ]
Did you find this page helpful?