d3arrayIndices

inline fun <T : Any> Multik.d3arrayIndices(    sizeD1: Int,     sizeD2: Int,     sizeD3: Int,     init: (i: Int, j: Int, k: Int) -> T): D3Array<T>

Creates a new 3-dimensions array of the specified (sizeD1, sizeD2, sizeD3) shape, where each element is calculated by calling the specified init function.

The function init is called for each array element sequentially starting from the first one. It should return the value for an array element given its indices.

Samples

import org.jetbrains.kotlinx.multik.api.*
import org.jetbrains.kotlinx.multik.ndarray.data.D2
import org.jetbrains.kotlinx.multik.ndarray.data.D3
import org.jetbrains.kotlinx.multik.ndarray.data.DN
import org.jetbrains.kotlinx.multik.ndarray.data.DataType
import kotlin.test.Test
fun main() { 
   //sampleStart 
   val ndarray = mk.d3arrayIndices(2, 2, 2) { i, j, k -> i + j + k }
println(ndarray)
/*
[[[0, 1],
  [1, 2]],

 [[1, 2],
  [2, 3]]]
 */ 
   //sampleEnd
}