Return the shape defined by the dimensions which are not included in a list of dimensions.
var complementShape = require( '@stdlib/ndarray/base/complement-shape' );Returns the shape defined by the dimensions which are not included in a list of dimensions.
var sh = complementShape( [ 3, 2 ], [ -1 ] );
// returns [ 3 ]The function accepts the following parameters:
- shape: array shape.
- dims: list of dimensions.
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var zip = require( '@stdlib/array/base/zip' );
var filled = require( '@stdlib/array/base/filled' );
var logEachMap = require( '@stdlib/console/log-each-map' );
var complementShape = require( '@stdlib/ndarray/base/complement-shape' );
var opts = {
'dtype': 'int32'
};
var d1 = discreteUniform( 100, 1, 10, opts );
var d2 = discreteUniform( d1.length, 1, 10, opts );
var d3 = discreteUniform( d1.length, 1, 10, opts );
var d4 = discreteUniform( d1.length, 1, 10, opts );
var dims = discreteUniform( 2, -4, 3, opts );
var shapes = zip( [ d1, d2, d3, d4 ] );
logEachMap( 'shape: (%s). dims: (%s). complement: (%s).', shapes, filled( dims, d1.length ), complementShape );