Skip to main content

arange

Function arange 

Source
pub fn arange(
    start: impl Into<Scalar>,
    stop: impl Into<Scalar>,
    step: impl Into<Scalar>,
) -> Array
Expand description

Evenly spaced values start, start + step, … below stop (above it for a negative step), as MLX: int32 when every argument is an integer (int64 when they do not fit), float32 when any is a float. Use Array::astype for another dtype.

use nuvec_core::{DType, ops::arange};

assert_eq!(arange(0, 5, 2).to_vec::<i32>().unwrap(), [0, 2, 4]);
assert_eq!(arange(0.0, 1.0, 0.25).dtype(), DType::F32);