klyn.math.NDArray.linspace
method
public static linspace(start as Double, stop as Double, count as Long = 50, endpoint as Boolean = true) as NDArray<T>
Description

Creates evenly spaced samples, including both endpoints by default. Integer specializations convert each sample to T after interpolation.

Parameters
ParameterDescription
startFirst sample.
stopLast sample when endpoint is true; otherwise the excluded bound.
countPositive number of samples. A single sample equals start.
endpointWhether to include stop.
Returns

A new one-dimensional array of samples.

Throws
  • ValueException if count is not positive or either bound is non-finite.
Example
x = NDArray<Double>.linspace(-Math.PI, Math.PI, 1000)
y = x.sin()