arange
Returns evenly spaced values within a given interval, where step is Integer.
Return
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
starting value of the interval. The interval includes this value.
end value of the interval. The interval doesn't include this value.
spacing between value. The default step is 1.
Returns evenly spaced values within a given interval, where step is Double.
Return
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
starting value of the interval. The interval includes this value.
end value of the interval. The interval doesn't include this value.
spacing between value. The step is Double.
Returns evenly spaced values within a given interval, where start of interval is 0. see Multik.arange
Return
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
end of the interval. The interval doesn't include this value.
spacing between value. The default step is 1.
Returns evenly spaced values within a given interval, where start of interval is 0 and the step is Double. see Multik.arange
Return
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
end value of the interval. The interval doesn't include this value.
spacing between value. The step is Double.