Function peroxide::util::non_macro::linspace_with_precision

source ·
pub fn linspace_with_precision<S, T>(
    start: S,
    end: T,
    length: usize,
    precision: usize,
) -> Vec<f64>
where S: Into<f64> + Copy, T: Into<f64> + Copy,
Expand description

linspace with precision

§Example

use peroxide::fuga::*;

let x = linspace(0, 1e-2, 11);
assert_ne!(x[9], 0.009);

let x = linspace_with_precision(0, 1e-2, 11, 3);
assert_eq!(x[9], 0.009);