RelaxedConvolution

Struct RelaxedConvolution 

Source
pub struct RelaxedConvolution<T, C>
where C: ConvolveSteps<T = Vec<T>>,
{ a: Vec<T>, b: Vec<T>, c: Vec<T>, _marker: PhantomData<fn() -> C>, }

Fields§

§a: Vec<T>§b: Vec<T>§c: Vec<T>§_marker: PhantomData<fn() -> C>

Implementations§

Source§

impl<T, C> RelaxedConvolution<T, C>
where T: Clone + Zero + AddAssign<T>, C: ConvolveSteps<T = Vec<T>>,

Source

pub fn push(&mut self, x: T, y: T)

Source

fn calc_block(&mut self, la: usize, lb: usize, size: usize)

Examples found in repository?
crates/competitive/src/math/relaxed_convolution.rs (line 64)
52    pub fn push(&mut self, x: T, y: T) {
53        let q = self.a.len();
54        self.a.push(x);
55        self.b.push(y);
56        self.c.push(T::zero());
57        if q != 0 {
58            self.c.push(T::zero());
59        }
60        let k = (q + 2).trailing_zeros();
61        let mut s = 0;
62        for k in 0..k + 1 - (1 << k == q + 2) as u32 {
63            let size = 1 << k;
64            self.calc_block(s, q + 1 - size, size);
65            if q + 1 - size != s {
66                self.calc_block(q + 1 - size, s, size);
67            }
68            s += size;
69        }
70    }

Trait Implementations§

Source§

impl<T: Debug, C> Debug for RelaxedConvolution<T, C>
where C: ConvolveSteps<T = Vec<T>>,

Source§

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

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

impl<T, C> Default for RelaxedConvolution<T, C>
where C: ConvolveSteps<T = Vec<T>>,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, C, I> Index<I> for RelaxedConvolution<T, C>
where C: ConvolveSteps<T = Vec<T>>, I: SliceIndex<[T]>,

Source§

type Output = <I as SliceIndex<[T]>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T, C> Freeze for RelaxedConvolution<T, C>

§

impl<T, C> RefUnwindSafe for RelaxedConvolution<T, C>
where T: RefUnwindSafe,

§

impl<T, C> Send for RelaxedConvolution<T, C>
where T: Send,

§

impl<T, C> Sync for RelaxedConvolution<T, C>
where T: Sync,

§

impl<T, C> Unpin for RelaxedConvolution<T, C>
where T: Unpin,

§

impl<T, C> UnwindSafe for RelaxedConvolution<T, C>
where T: UnwindSafe,

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