Remove singleton dimensions from an ndarray
npm install ndarray-squeeze> Remove singleton dimensions from an ndarray
This module takes an input ndarray and removes any dimensions with length 1 or, optionally, specified dimensions with length 1.
``javascript
var ndarray = require('ndarray')
var squeeze = require('ndarray-squeeze')
squeeze(ndarray([1, 2, 3, 4], [2, 1, 1, 2, 1]))
// => ndarray([1, 2, 3, 4], [2, 2])
squeeze(ndarray([1, 2, 3, 4], [2, 1, 1, 2, 1]), [1])
// => ndarray([1, 2, 3, 4], [2, 1, 2, 1])
`
`javascript`
$ npm install ndarray-squeeze
#### require('ndarray-squeeze')(input[, axes])
Arguments:
- input: The input ndarray to be squeezedaxes
- (optional): An Array list of dimensions to be squeezed. Non-singleton dimensions will be ignored. If not provided, all singleton dimensions will be removed.
Returns:
A new array view of the squeezed ndarray (i.e. a new ndarray object with the same underlying data).