public flatten() as NDArray<T>
Copies the NDArray into an independent contiguous 1D array in row-major order. Primitive bits are copied in bulk, without boxing or conversion. Changes to the result do not affect the original, and conversely.
A flattened copy with the same element type, including empty arrays.
a = NDArray<Int>([[1, 2], [3, 4]]) b = a.flatten() a.flat[0] = 99 assert b.flat[0] == 1