d3array
Creates a 3D array of the given shape, where each element is computed by a flat-index init function. Elements are filled in row-major order. For per-element (i, j, k) indices, use d3arrayIndices.
Signature
inline fun <reified T : Any> Multik.d3array(
sizeD1: Int,
sizeD2: Int,
sizeD3: Int,
noinline init: (Int) -> T
): D3Array<T>
Parameters
Parameter | Type | Description |
|---|---|---|
|
| Size of the first axis. Must be positive. |
|
| Size of the second axis. Must be positive. |
|
| Size of the third axis. Must be positive. |
|
| Lambda that receives a flat index (0 to |
Returns: D3Array<T>
Example
val t = mk.d3array<Int>(2, 3, 4) { it }
// shape (2, 3, 4), elements 0..23
28 February 2026