Equana

Back to NDArray Operations

reshape

Reshape an array to the given dimensions. Total element count must match.

Syntax

reshape(a: NDArray, n: Int64) → r

Backends

TypeScriptnumwa

Description

Reshape an array to the given dimensions. Total element count must match.

Parameters

NameDescription
aInput array
nNew first dimension (or single dimension for 1D)

Returns

NDArray with the new shape, sharing the same data

Examples

Try It
>> reshape([1,2,3,4,5,6], 2, 3)
2×3 matrix