Skip to main content

StencilTable

Struct StencilTable 

Source
pub struct StencilTable {
    pub offsets: Vec<u32>,
    pub indices: Vec<u32>,
    pub weights: Vec<f32>,
}
Expand description

A sparse linear map from input points to output points.

Each output point is a weighted sum of a few input points — its stencil. Apply it to any Interpolatable data with interpolate().

Stored compressed (CSR): output i’s source indices and weights are the slices indices[offsets[i]..offsets[i + 1]] and the matching weights.

Fields§

§offsets: Vec<u32>

CSR row offsets. Length = output_count + 1.

§indices: Vec<u32>

Source indices (into the input buffer), flat.

§weights: Vec<f32>

Source weights (parallel to indices).

Implementations§

Source§

impl StencilTable

Source

pub fn output_count(&self) -> usize

Number of output points this table produces.

Source

pub fn interpolate<T: Interpolatable>(&self, input: &[T]) -> Vec<T>

Apply stencils to an input buffer, producing one output value per stencil.

Source

pub fn interpolate_rows<T: Interpolatable>( &self, input: &[T], rows: &[u32], output: &mut [T], )

Apply stencils for only rows, scattering each result into output[row] and leaving every other entry untouched.

The CPU analogue of an indexed (sparse) dispatch: pair with affected_outputs to re-evaluate only the outputs a control-point edit changed, splicing them into the previous output buffer. Bit-identical to interpolate on the recomputed rows.

output must have at least output_count entries and every index in rows must be < output_count.

Source

pub fn compose(&self, other: &StencilTable) -> Self

Compose two stencil tables: self maps A→B, other maps B→C. The result maps A→C by substituting B’s stencils into C’s.

Source

pub fn identity(count: usize) -> Self

Identity table of count rows: each output copies its input unchanged.

Trait Implementations§

Source§

impl Clone for StencilTable

Source§

fn clone(&self) -> StencilTable

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 Debug for StencilTable

Source§

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

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

impl<'de> Deserialize<'de> for StencilTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<'a> From<&'a StencilTable> for InverseStencilMap

Source§

fn from(table: &'a StencilTable) -> Self

Build the inverse (transpose) of table in a single pass over its entries.

Source§

impl PartialEq for StencilTable

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for StencilTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for StencilTable

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,