Skip to main content

linspace

Function linspace 

Source
pub fn linspace<T: Float + Clone + 'static>(
    start: T,
    stop: T,
    num: usize,
) -> Array<T>
Expand description

Create evenly spaced values between start and stop (inclusive)

§Parameters

  • start - The starting value of the sequence
  • stop - The end value of the sequence (inclusive)
  • num - Number of samples to generate

§Returns

An array with num evenly spaced values from start to stop

§Examples

use numrs2::math::linspace;

let arr = linspace(0.0, 1.0, 5);
assert_eq!(arr.size(), 5);
// Values: 0.0, 0.25, 0.5, 0.75, 1.0