linspace static method
Generates a sequence of evenly spaced values over a specified interval.
Similar to NumPy's linspace. Returns num samples from start to stop.
If endpoint is true (default), stop is included as the last value.
If endpoint is false, stop is excluded.
Implementation
static Float32List linspace(
double start,
double stop, {
int num = 50,
bool endpoint = true,
}) {
if (num < 2) {
return Float32List.fromList([start]);
}
final out = Float32List(num);
final step = endpoint ? (stop - start) / (num - 1) : (stop - start) / num;
for (int i = 0; i < num; i++) {
out[i] = start + step * i;
}
return out;
}