Resize an array into a new dimension layout, trimming or padding values.
Numeric.shape.resize(input, shape)Rebuilds the array with the requested dimensions.
- Parameters:
input: Nested array to resizeshape: Target dimensions of the resized array
- Returns: Array holding the resized values
- NumPy: Covers
np.resize,ndarray.resizethrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const values = Numeric.shape.resize([[1, 2], [3, 4]], [3])
console.log(values)
// [1,2,3]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.resize([1, 2, 3, 4], [2, 2])
console.log(matrix)
// [[1,2],[3,4]]import Numeric from '@neabyte/numerix'
const values = Numeric.shape.resize([1, 2], [4])
console.log(values)
// [1,2,1,2]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.resize([1, 2, 3], [1, 3])
console.log(matrix)
// [[1,2,3]]