toNDArray

inline fun <T : Number> Iterable<T>.toNDArray(): D1Array<T>
@JvmName(name = "toComplexNDArray")
inline fun <T : Complex> Iterable<T>.toNDArray(): D1Array<T>

Returns D1Array containing all elements.

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 list = listOf(1, 2, 3, 4)
val ndarray = list.toNDArray()
println(ndarray) // [1, 2, 3, 4] 
   //sampleEnd
}

@JvmName(name = "List2DToNDArrayNumber")
inline fun <T : Number> List<List<T>>.toNDArray(): D2Array<T>
@JvmName(name = "List2DToNDArrayComplex")
inline fun <T : Complex> List<List<T>>.toNDArray(): D2Array<T>

Returns D2Array containing all elements.


@JvmName(name = "List3DToNDArrayNumber")
inline fun <T : Number> List<List<List<T>>>.toNDArray(): D3Array<T>
@JvmName(name = "List3DToNDArrayComplex")
inline fun <T : Complex> List<List<List<T>>>.toNDArray(): D3Array<T>

Returns D3Array containing all elements.


@JvmName(name = "List4DToNDArrayNumber")
inline fun <T : Number> List<List<List<List<T>>>>.toNDArray(): D4Array<T>
@JvmName(name = "List4DToNDArrayComplex")
inline fun <T : Complex> List<List<List<List<T>>>>.toNDArray(): D4Array<T>

Returns D4Array containing all elements.


fun Array<ByteArray>.toNDArray(): D2Array<Byte>
fun Array<ShortArray>.toNDArray(): D2Array<Short>
fun Array<IntArray>.toNDArray(): D2Array<Int>
fun Array<LongArray>.toNDArray(): D2Array<Long>
fun Array<FloatArray>.toNDArray(): D2Array<Float>
fun Array<DoubleArray>.toNDArray(): D2Array<Double>

Returns an D2Array.