public property flat[index as Long] as T
Reads or writes one scalar using a row-major linear index, at any rank. This indexed property does not allocate a view, copy or iterator. The last axis varies fastest. Negative indices count backwards from the end.
| Parameter | Description |
|---|---|
index | Zero-based linear position, or a negative position from the end. |
The element of type T; assignments update this array directly.
matrix = NDArray<Int>([[1, 2], [3, 4]]) matrix.flat[2] = 42 assert matrix[1, 0] == 42 and matrix.flat[-1] == 4