Multik 0.3.0 Help

reversed

Returns a new array with elements in reverse row-major order. The shape is preserved.

Signature

fun <T, D : Dimension> MultiArray<T, D>.reversed(): NDArray<T, D>

Returns: NDArray<T, D> — a new array with the same shape but elements in reverse row-major order.

Example

val a = mk.ndarray(mk[1, 2, 3, 4, 5]) a.reversed() // [5, 4, 3, 2, 1] val m = mk.ndarray(mk[mk[1, 2], mk[3, 4]]) m.reversed() // [[4, 3], // [2, 1]]
28 February 2026