Skip to main content

Range

Struct Range 

Source
pub struct Range {
    pub lo: f64,
    pub hi: f64,
}
Expand description

The values other than NaN that the items of an argument or a result can take: each lies from lo to hi. ¯0 and +0 count as one value, because the sign of a zero isn’t promised and can differ by route. Any range can also hold NaN. A rule’s range is sound where it holds every result that the object’s kernels give, within their accuracy.

Fields§

§lo: f64§hi: f64

Implementations§

Source§

impl Range

Source

pub const ANY: Range

Every value.

Source

pub const NONNEGATIVE: Range

Every value from 0 up.

Source

pub const EMPTY: Range

No value, as an array of no items holds. It’s join’s identity: its lo is ∞ and its hi ¯∞.

Source

pub fn of(c: Option<f64>) -> Range

The range of an argument that is the one number c, or ANY where c is NaN or None, as for an argument that isn’t one number.

Source

pub fn of_dtype(dtype: DType) -> Range

The values that items of dtype hold: 0 and 1 for Booleans, from each integer width’s least integer to its greatest, and any value for other dtypes.

Source

pub fn constant(self) -> Option<f64>

The one number that the range holds, if it holds only one.

Source

pub fn nonnegative(self) -> bool

Whether the range holds no negative number.

Source

pub fn is_empty(self) -> bool

Whether the range holds no value (EMPTY).

Source

pub fn within(self, lo: f64, hi: f64) -> bool

Whether every value lies from lo to hi.

Source

pub fn excludes(self, c: f64) -> bool

Whether no value equals c.

Source

pub fn meet(self, other: Range) -> Range

The values that both ranges hold.

Source

pub fn join(self, other: Range) -> Range

The least range that holds both ranges.

Source

pub fn magnitude(self) -> Range

The range of |x| for the values x of this range.

Source

pub fn square(self) -> Range

The range of x × x for the values x of this range, as ⊼x squares them.

Source

pub fn folded( items: Range, seed: Option<Range>, lane: Option<usize>, step: impl Fn([Range; 2]) -> Range, ) -> Range

The range of a fold’s results, from its items’ range, its seed’s, if it has one, and step, which gives the range of a step’s result from the ranges of its two arguments. Every lane holds an item. One bound holds for any fold: the least range that holds the items and the seed, where a step’s results stay in it. Where they don’t, as a sum’s don’t, each bound widens to an infinity, except that a bound on the far side of 0 stops at 0: [2, 3] widens to [0, ∞]. Where a step’s results leave that range too, that bound is ANY.

Where lane gives the most items that a lane holds and step is an associative function’s, as + × ⌈ ⌊ ∧ ∨ are, a second bound holds, and the range is the meet of both. It starts at the items’ range, and joins in step of the range on itself while the lane length that it covers doubles, up to lane: [2, 3] over lanes of up to 4 items gives [2, 12]. It holds because a lane of up to 2m items splits into two lanes of up to m items whose results, by associativity, one step combines, and step bounds that step for any arguments within its two ranges. A scan’s running results are the results of shorter lanes. A seed then combines with that bound in one step, as associativity lets it combine with a lane’s result, and its own range joins in for a lane of no items.

Source

pub fn at_width(self, dtype: DType) -> Range

This range as a kernel’s results of dtype hold it. The bounds are f64, and a kernel at a narrower float rounds each result to that width, within its accuracy there: each bound moves ULPS units in that width’s last place outward, as loose moves it at f64. A kernel at an integer dtype gives whole results, flooring a quotient as integer ÷ does: each bound rounds outward to a whole number. Other dtypes keep the range.

Trait Implementations§

Source§

impl Clone for Range

Source§

fn clone(&self) -> Range

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Range

Source§

impl Debug for Range

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Range

Source§

fn eq(&self, other: &Range) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Range

Auto Trait Implementations§

§

impl Forget for Range

§

impl Freeze for Range

§

impl RefUnwindSafe for Range

§

impl Send for Range

§

impl Sync for Range

§

impl Unpin for Range

§

impl UnsafeUnpin for Range

§

impl UnwindSafe for Range

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.