ndarrayOf
Creates a 1D array directly from a variable number of elements. Type-specific overloads are provided for all primitive numeric types and complex types.
Signature
fun Multik.ndarrayOf(vararg items: Byte): D1Array<Byte>
fun Multik.ndarrayOf(vararg items: Short): D1Array<Short>
fun Multik.ndarrayOf(vararg items: Int): D1Array<Int>
fun Multik.ndarrayOf(vararg items: Long): D1Array<Long>
fun Multik.ndarrayOf(vararg items: Float): D1Array<Float>
fun Multik.ndarrayOf(vararg items: Double): D1Array<Double>
inline fun <reified T : Complex> Multik.ndarrayOf(vararg items: T): D1Array<T>
Parameters
Parameter | Type | Description |
|---|---|---|
|
| Elements of the array. |
Returns: D1Array<T>
Example
val a = mk.ndarrayOf(1, 2, 3) // D1Array<Int>: [1, 2, 3]
val b = mk.ndarrayOf(1.0, 2.0, 3.0) // D1Array<Double>: [1.0, 2.0, 3.0]
28 February 2026