// Typed matrices are built in. Shape and coordinates contain explicit Int64s.
let matrix = NDArray<Int64>(shape: List(2, 3), fill: 0)
matrix.set(List(0, 0), 1)
matrix.set(List(0, 1), 2)
matrix.set(List(0, 2), 3)
matrix.set(List(1, 0), 4)
matrix.set(List(1, 1), 5)
matrix.set(List(1, 2), 6)
print(matrix.shape())
print(matrix.strides())
print(matrix.to_list())
let alternate = matrix.reshape(shape: List(3, 2))
alternate.set(List(0, 0), 99) // Shared fixed buffer; the original sees this value.
print(matrix.get(List(0, 0)))
let transposed = matrix.transpose() // Independent contiguous copy.
print(transposed.shape())
print(transposed.to_list())
let flat = matrix.flatten() // Independent fixed Array.
flat.set(0, -1)
print(matrix.get(List(0, 0)))
let cube = NDArray<Bool>(shape: List(2, 2, 2), fill: false)
cube.set(List(1, 0, 1), true)
print(cube.permute(axes: List(2, 0, 1)).shape())
let empty = NDArray<String>(shape: List(2, 0, 3), fill: "")
print(empty.len())
print(empty.strides())
