klyn.math.NDArray.flatten
method
public flatten() as NDArray<T>
Description

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.

Returns

A flattened copy with the same element type, including empty arrays.

Example
a = NDArray<Int>([[1, 2], [3, 4]])
b = a.flatten()
a.flat[0] = 99
assert b.flat[0] == 1