d1array

inline fun <T : Any> Multik.d1array(sizeD1: Int, noinline init: (Int) -> T): D1Array<T>

Returns a 1-dimension array.

Return

D1Array.

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.d1array(3) { -it }
println(ndarray) // [0, -1, -2] 
   //sampleEnd
}

Parameters

sizeD1

value of 1-dimension.

init

initialization function