arange

inline fun <T : Number> Multik.arange(    start: Int,     stop: Int,     step: Int = 1): D1Array<T>

Returns evenly spaced values within a given interval, where step is Integer.

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.arange<Float>(start = 2, stop = 5)
val ndarrayWithStep = mk.arange<Int>(2, 7, 2)

println(ndarray) // [2.0, 3.0, 4.0]
println(ndarrayWithStep) // [2, 4, 6] 
   //sampleEnd
}

Parameters

start

starting value of the interval. The interval includes this value.

stop

end value of the interval. The interval doesn't include this value.

step

spacing between value. The default step is 1.


inline fun <T : Number> Multik.arange(    start: Int,     stop: Int,     step: Double): D1Array<T>

Returns evenly spaced values within a given interval, where step is Double.

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.arange<Float>(1, 7, 1.3)
println(ndarray) // [1.0, 2.3, 3.6, 4.9, 6.2] 
   //sampleEnd
}

Parameters

start

starting value of the interval. The interval includes this value.

stop

end value of the interval. The interval doesn't include this value.

step

spacing between value. The step is Double.


inline fun <T : Number> Multik.arange(stop: Int, step: Int = 1): D1Array<T>

Returns evenly spaced values within a given interval, where start of interval is 0. see Multik.arange

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.arange<Int>(10)
val ndarrayStep = mk.arange<Long>(10, 2)
println(ndarray) // [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
println(ndarrayStep) // [0, 2, 4, 6, 8] 
   //sampleEnd
}

Parameters

stop

end of the interval. The interval doesn't include this value.

step

spacing between value. The default step is 1.


inline fun <T : Number> Multik.arange(stop: Int, step: Double): D1Array<T>

Returns evenly spaced values within a given interval, where start of interval is 0 and the step is Double. see Multik.arange

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.arange<Double>(5, 0.5)
println(ndarray) // [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5] 
   //sampleEnd
}

Parameters

stop

end value of the interval. The interval doesn't include this value.

step

spacing between value. The step is Double.