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: f64Implementations§
Source§impl Range
impl Range
Sourcepub const NONNEGATIVE: Range
pub const NONNEGATIVE: Range
Every value from 0 up.
Sourcepub const EMPTY: Range
pub const EMPTY: Range
No value, as an array of no items holds. It’s join’s identity: its lo is ∞ and its hi ¯∞.
Sourcepub fn of(c: Option<f64>) -> Range
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.
Sourcepub fn of_dtype(dtype: DType) -> Range
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.
Sourcepub fn constant(self) -> Option<f64>
pub fn constant(self) -> Option<f64>
The one number that the range holds, if it holds only one.
Sourcepub fn nonnegative(self) -> bool
pub fn nonnegative(self) -> bool
Whether the range holds no negative number.
Sourcepub fn square(self) -> Range
pub fn square(self) -> Range
The range of x × x for the values x of this range, as ⊼x squares them.
Sourcepub fn folded(
items: Range,
seed: Option<Range>,
lane: Option<usize>,
step: impl Fn([Range; 2]) -> Range,
) -> Range
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.
Sourcepub fn at_width(self, dtype: DType) -> Range
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§
impl Copy for Range
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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