Function itertools::linspace [] [src]

pub fn linspace<F>(a: F, b: F, n: usize) -> Linspace<F> where F: Copy + Sub<Output=F> + Div<Output=F> + Mul<Output=F>, usize: ToFloat<F>

Return an iterator of evenly spaced floats.

The Linspace has n elements, where the first element is a and the last element is b.

Iterator element type is F, where F must be either f32 or f64.

use itertools::linspace;

itertools::assert_equal(linspace::<f32>(0., 1., 5),
                        vec![0., 0.25, 0.5, 0.75, 1.0]);