pub enum Reduce {
Sum,
Product,
Max,
Min,
And,
Or,
Xor,
Xnor,
}Expand description
A reduction by name: the tag by which a function object’s row names the reduction it folds by (facts::Facts::fold, facts::Facts::truth), and by which a frontend’s block stages and compiled code fold. with_reduce! gives its type.
Variants§
Implementations§
Source§impl Reduce
impl Reduce
Sourcepub fn stage(self, item: DType, exact: bool) -> bool
pub fn stage(self, item: DType, exact: bool) -> bool
Whether a block stage folds items of item by this reduction a block at a time: floats by a sum, a product, a maximum or a minimum; integers by a maximum or a minimum, and by a sum where its sums are exact (exact), as a sum whose range lies within the items’ type is; Booleans by a sum (a count), a minimum, a maximum, an exclusive or or its negation.
Sourcepub fn seeds(self, items: DType, seed: DType, result: DType) -> bool
pub fn seeds(self, items: DType, seed: DType, result: DType) -> bool
Whether a stage’s fold by this reduction of items of items takes a seed of type seed into a result of type result, merging the seed into each total at the end: floats with a float seed, where the result keeps the items’ width; integers with an integer or Boolean seed by a maximum or a minimum, or by a sum into a result of the items’ type; and a count of Booleans with an integer or Boolean seed. A sum of integers into a wider integer folds after the stage, because compiled code sums integers at the items’ width.
Source§impl Reduce
impl Reduce
pub fn total_dtype(self, variant: Variant) -> Option<DType>
pub fn run_pieces( self, variant: Variant, dims: [usize; 3], seed: Seed<'_>, pieces: &Pieces<'_>, output: &mut Buffer, ) -> Result<(), Error>
pub fn run_read( self, variant: Variant, shape: &[usize], axis: Option<usize>, seed: Seed<'_>, input: Read<'_>, output: &mut Buffer, ) -> Result<Option<Vec<Steps>>, Error>
Sourcepub fn run_sliding_2d(
self,
variant: Variant,
dims: [usize; 5],
widths: [usize; 2],
every: [usize; 2],
input: View<'_>,
output: &mut Buffer,
) -> Result<(), Error>
pub fn run_sliding_2d( self, variant: Variant, dims: [usize; 5], widths: [usize; 2], every: [usize; 2], input: View<'_>, output: &mut Buffer, ) -> Result<(), Error>
The folds by this reduction of each window along axes 1 and 3 of input, an array of shape dims, as sliding_2d folds them, with each axis’s window width and the positions between windows’ starts. A domain error for windows wider than sliding_2d folds directly.
Sourcepub fn run_groups(
self,
variant: Variant,
groups: &impl Grouping,
input: View<'_>,
output: &mut Buffer,
) -> Result<(), Error>
pub fn run_groups( self, variant: Variant, groups: &impl Grouping, input: View<'_>, output: &mut Buffer, ) -> Result<(), Error>
The fold by this reduction of each group of input that groups gives, in group order (Grouping::fold).
pub fn inverse_pieces( self, variant: Variant, dims: [usize; 3], pieces: &Pieces<'_>, ) -> Result<Option<Buffer>, Error>
pub fn inverse_read( self, variant: Variant, shape: &[usize], axis: usize, input: Read<'_>, ) -> Result<Option<Buffer>, Error>
Trait Implementations§
impl Copy for Reduce
impl Eq for Reduce
impl StructuralPartialEq for Reduce
Auto Trait Implementations§
impl Forget for Reduce
impl Freeze for Reduce
impl RefUnwindSafe for Reduce
impl Send for Reduce
impl Sync for Reduce
impl Unpin for Reduce
impl UnsafeUnpin for Reduce
impl UnwindSafe for Reduce
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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