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>
impl<T, C> RelaxedConvolution<T, C>
pub fn push(&mut self, x: T, y: T)
Sourcefn calc_block(&mut self, la: usize, lb: usize, size: usize)
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>>,
impl<T: Debug, C> Debug for RelaxedConvolution<T, C>where
C: ConvolveSteps<T = Vec<T>>,
Source§impl<T, C> Default for RelaxedConvolution<T, C>where
C: ConvolveSteps<T = Vec<T>>,
impl<T, C> Default for RelaxedConvolution<T, C>where
C: ConvolveSteps<T = Vec<T>>,
Source§impl<T, C, I> Index<I> for RelaxedConvolution<T, C>
impl<T, C, I> Index<I> for RelaxedConvolution<T, C>
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> 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
Mutably borrows from an owned value. Read more