Multik 0.3.0 Help

linspace

Creates a 1D array of exactly num evenly spaced values over the closed interval [start, stop]. Unlike arange, both endpoints are included and the number of points is specified directly rather than a step size.

Signatures

inline fun <reified T : Number> Multik.linspace( start: Int, stop: Int, num: Int = 50 ): D1Array<T> inline fun <reified T : Number> Multik.linspace( start: Double, stop: Double, num: Int = 50 ): D1Array<T>

Parameters

Parameter

Type

Default

Description

start

Int or Double

Start of the interval (inclusive).

stop

Int or Double

End of the interval (inclusive).

num

Int

50

Number of values to generate. Must be > 0.

Returns: D1Array<T> with num evenly spaced values from start to stop inclusive.

Example

val a = mk.linspace<Double>(0, 1, 5) // [0.0, 0.25, 0.5, 0.75, 1.0] val b = mk.linspace<Float>(0.0, 10.0, 3) // [0.0, 5.0, 10.0]

linspace vs arange

linspace

arange

Endpoint

Included (stop is the last element)

Excluded (stop is not included)

Control

Specify number of points

Specify step size

Precision

Last element guaranteed to equal stop

May accumulate floating-point drift

28 February 2026