Skip to main content

RunSumPlan

Struct RunSumPlan 

Source
pub struct RunSumPlan { /* private fields */ }
Expand description

dest[r, ..] (=|+=) Σ_{j in ptr[r]..ptr[r+1]} src[perm[j], ..].

Compiled once for a source layout, a destination layout and a RunIndex’s row count; replayed with execute_into or execute_acc.

Implementations§

Source§

impl RunSumPlan

Source

pub fn compile( src_dims: &[usize], src_strides: &[isize], dest_dims: &[usize], dest_strides: &[isize], runs: &RunIndex, ) -> Result<Self>

Compile a replay for one source layout, one destination layout and the run count the index describes.

The layout facts a plan can prove without the buffers are proved here; buffer bounds, alignment and the absence of dest/src overlap are the caller’s RawStridedRef / RawStridedMut obligations. Allocates the fused payload traversal; never called from the execute path.

§Errors

Returns StridedError::StrideLengthMismatch when a stride list does not match its dimension list, StridedError::RankMismatch when the ranks differ or there is no row axis, StridedError::ShapeMismatch when the trailing extents differ or the row counts disagree with runs, StridedError::OffsetOverflow when an element count does not fit usize, and StridedError::NonInjectiveOutputLayout when the destination layout cannot be proven injective.

Source

pub fn execute_into<T>( &self, dest: &mut RawStridedMut<'_, T>, src: &RawStridedRef<'_, T>, runs: &RunIndex, exec: Exec<'_>, ) -> Result<()>
where T: Copy + Zero + Add<Output = T> + Send + Sync,

Execute the overwriting form: dest[r, ..] = Σ over the run, zeros for a run with no rows. Never reads the previous destination value.

§Errors

Returns StridedError::PlanLayoutMismatch when a view does not carry its compiled extents and strides, and StridedError::ShapeMismatch when runs describes a different row or run count than compile was given.

Source

pub fn execute_acc<T>( &self, dest: &mut RawStridedMut<'_, T>, src: &RawStridedRef<'_, T>, runs: &RunIndex, exec: Exec<'_>, ) -> Result<()>
where T: Copy + Zero + Add<Output = T> + Send + Sync,

Execute the accumulating form: dest[r, ..] += Σ over the run, nothing for a run with no rows.

§Errors

As execute_into.

Trait Implementations§

Source§

impl Debug for RunSumPlan

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<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, 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.