Skip to content

Latest commit

 

History

History
132 lines (78 loc) · 2.9 KB

File metadata and controls

132 lines (78 loc) · 2.9 KB

reducedShape

Return a reduced shape of an ndarray.

Usage

var reducedShape = require( '@stdlib/ndarray/base/reduced-shape' );

reducedShape( x, dims )

Returns a reduced shape of an ndarray.

var zeros = require( '@stdlib/ndarray/zeros' );

var x = zeros( [ 3, 2, 3 ] );
// returns <ndarray>

var sh = reducedShape( x, [ 0, 1 ] );
// returns [ 3 ]

Examples

var zeros = require( '@stdlib/ndarray/zeros' );
var reducedShape = require( '@stdlib/ndarray/base/reduced-shape' );

// Create an array:
var x = zeros( [ 1, 2, 3, 2 ] );
// returns <ndarray>

var sh = reducedShape( x, [ 0, 1 ] );
console.log( sh );
// => [ 3, 2 ]

sh = reducedShape( x, [ 0, 3 ] );
console.log( sh );
// => [ 2, 3 ]

sh = reducedShape( x, [ 1, 3 ] );
console.log( sh );
// => [ 1, 3 ]