pub struct BitwisexorConvolve<M, const EXACT_DIVISION: bool = false> {
_marker: PhantomData<fn() -> M>,
}Expand description
EXACT_DIVISION normalizes with division instead of a multiplicative inverse.
Fields§
§_marker: PhantomData<fn() -> M>Implementations§
Source§impl<G, const EXACT_DIVISION: bool> BitwisexorConvolve<G, EXACT_DIVISION>where
G: Group,
impl<G, const EXACT_DIVISION: bool> BitwisexorConvolve<G, EXACT_DIVISION>where
G: Group,
Sourcepub fn hadamard_transform(f: &mut [G::T])
pub fn hadamard_transform(f: &mut [G::T])
Examples found in repository?
crates/competitive/src/math/bitwisexor_convolve.rs (line 61)
60 fn transform(mut t: Self::T, _len: usize) -> Self::F {
61 BitwisexorConvolve::<R::Additive, EXACT_DIVISION>::hadamard_transform(&mut t);
62 t
63 }
64
65 fn inverse_transform(mut f: Self::F, len: usize) -> Self::T {
66 BitwisexorConvolve::<R::Additive, EXACT_DIVISION>::hadamard_transform(&mut f);
67 let len = R::T::from_length(len);
68 if EXACT_DIVISION {
69 for f in &mut f {
70 *f = R::div(f, &len);
71 }
72 } else if !f.is_empty() {
73 let inv_len = R::inv(&len);
74 for f in &mut f {
75 *f = R::mul(f, &inv_len);
76 }
77 }
78 f
79 }Trait Implementations§
Source§impl<R, const EXACT_DIVISION: bool> ConvolveSteps for BitwisexorConvolve<R, EXACT_DIVISION>where
R: Field<T: PartialEq + FromLength<EXACT_DIVISION>, Additive: Invertible, Multiplicative: Invertible>,
impl<R, const EXACT_DIVISION: bool> ConvolveSteps for BitwisexorConvolve<R, EXACT_DIVISION>where
R: Field<T: PartialEq + FromLength<EXACT_DIVISION>, Additive: Invertible, Multiplicative: Invertible>,
type T = Vec<<R as SemiRing>::T>
type F = Vec<<R as SemiRing>::T>
fn length(t: &Self::T) -> usize
fn transform(t: Self::T, _len: usize) -> Self::F
fn inverse_transform(f: Self::F, len: usize) -> Self::T
fn multiply(f: &mut Self::F, g: &Self::F)
fn convolve(a: Self::T, b: Self::T) -> Self::T
Source§const CYCLIC: bool = false
const CYCLIC: bool = false
Whether transform multiplication computes modulo x^n - 1 in the coefficient ring.
fn square(t: Self::T, len: usize) -> Self::T
Auto Trait Implementations§
impl<M, const EXACT_DIVISION: bool> Freeze for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> RefUnwindSafe for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> Send for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> Sync for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> Unpin for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> UnsafeUnpin for BitwisexorConvolve<M, EXACT_DIVISION>
impl<M, const EXACT_DIVISION: bool> UnwindSafe for BitwisexorConvolve<M, EXACT_DIVISION>
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