Function simple_shapes::linspace

source ·
pub fn linspace<F>(a: F, b: F, n: usize) -> Linspace<F>where
    F: Float,
Expand description

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.

extern crate itertools;
extern crate itertools_num;

use itertools_num::linspace;

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