Reshape nested values into a new dimension layout.
Numeric.shape.reshape(input, shape, order = 'C')Rebuilds the array with the requested dimensions.
- Parameters:
input: Nested array to reshapeshape: Target dimensions of the reshaped arrayorder: Memory layout order, row-major or column-major
- Returns: Array holding the reshaped values
- NumPy: Covers
np.reshape,ndarray.reshapethrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const values = Numeric.shape.reshape([[1, 2], [3, 4]], [4])
console.log(values)
// [1,2,3,4]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.reshape([1, 2, 3, 4], [2, 2])
console.log(matrix)
// [[1,2],[3,4]]import Numeric from '@neabyte/numerix'
const values = Numeric.shape.reshape([1, 2, 3, 4], [2, 1, 2])
console.log(values)
// [[[1,2]],[[3,4]]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.reshape([1, 2, 3], [1, 3])
console.log(matrix)
// [[1,2,3]]