Multik 0.3.0 Help

repeat

Tiles the array's elements n times into a new flat 1D array. Multi-dimensional arrays are flattened before tiling.

Signature

fun <T, D : Dimension> MultiArray<T, D>.repeat(n: Int): D1Array<T>

Parameters

Parameter

Type

Description

n

Int

Number of repetitions. Must be at least 1.

Returns: D1Array<T> — a new flat 1D array with size this.size * n.

Example

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