d3arrayIndices
Creates a 3D array of the given shape, where each element is computed from its three axis indices (i, j, k). Useful when the element value depends on its position in the 3D space.
Signature
inline fun <reified T : Any> Multik.d3arrayIndices(
sizeD1: Int,
sizeD2: Int,
sizeD3: Int,
init: (i: Int, j: Int, k: 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 indices along each axis. |
Returns: D3Array<T>
Example
val t = mk.d3arrayIndices<Int>(2, 3, 4) { i, j, k -> i * 100 + j * 10 + k }
// t[1, 2, 3] == 123
28 February 2026