Skip to content

Latest commit

 

History

History
63 lines (41 loc) · 1.05 KB

squeeze.md

File metadata and controls

63 lines (41 loc) · 1.05 KB

squeeze

Remove length one dimensions from a nested array.

API

Numeric.shape.squeeze(input, chosen)

Removes single entry dimensions from the array.

  • Parameters:
    • input: Nested array to squeeze
    • chosen: Optional axis or list of axes to squeeze
  • Returns: Array without the single entry dimensions
  • NumPy: Covers np.squeeze, ndarray.squeeze through a single Numerix method.

Examples

Squeeze a column vector

import Numeric from '@neabyte/numerix'

const values = Numeric.shape.squeeze([[1], [2]])

console.log(values)
// [1,2]

Squeeze a single row matrix

import Numeric from '@neabyte/numerix'

const values = Numeric.shape.squeeze([[1, 2]])

console.log(values)
// [1,2]

Squeeze a nested single entry dimension

import Numeric from '@neabyte/numerix'

const values = Numeric.shape.squeeze([[[1, 2]]])

console.log(values)
// [1,2]

Squeeze a plain vector

import Numeric from '@neabyte/numerix'

const values = Numeric.shape.squeeze([1, 2, 3])

console.log(values)
// [1,2,3]