Multik 0.3.0 Help

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

sizeD1

Int

Size of the first axis. Must be positive.

sizeD2

Int

Size of the second axis. Must be positive.

sizeD3

Int

Size of the third axis. Must be positive.

init

(Int) -> T

Lambda that receives a flat index (0 to sizeD1 * sizeD2 * sizeD3 - 1). Elements are filled in row-major order.

Returns: D3Array<T>

Example

val t = mk.d3array<Int>(2, 3, 4) { it } // shape (2, 3, 4), elements 0..23
28 February 2026