Skip to main content

BitwisexorConvolve

Struct BitwisexorConvolve 

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

Source

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

Source§

type T = Vec<<R as SemiRing>::T>

Source§

type F = Vec<<R as SemiRing>::T>

Source§

fn length(t: &Self::T) -> usize

Source§

fn transform(t: Self::T, _len: usize) -> Self::F

Source§

fn inverse_transform(f: Self::F, len: usize) -> Self::T

Source§

fn multiply(f: &mut Self::F, g: &Self::F)

Source§

fn convolve(a: Self::T, b: Self::T) -> Self::T

Source§

const CYCLIC: bool = false

Whether transform multiplication computes modulo x^n - 1 in the coefficient ring.
Source§

fn square(t: Self::T, len: usize) -> Self::T
where Self::T: Clone,

Auto Trait Implementations§

§

impl<M, const EXACT_DIVISION: bool> Freeze for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: Freeze,

§

impl<M, const EXACT_DIVISION: bool> RefUnwindSafe for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: RefUnwindSafe,

§

impl<M, const EXACT_DIVISION: bool> Send for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: Send,

§

impl<M, const EXACT_DIVISION: bool> Sync for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: Sync,

§

impl<M, const EXACT_DIVISION: bool> Unpin for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: Unpin,

§

impl<M, const EXACT_DIVISION: bool> UnsafeUnpin for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: UnsafeUnpin,

§

impl<M, const EXACT_DIVISION: bool> UnwindSafe for BitwisexorConvolve<M, EXACT_DIVISION>
where PhantomData<fn() -> M>: 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> ToArrayVecScalar for T

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.