pub struct NTT<P: PrimeMod> { /* private fields */ }Expand description
素数$P$上の数論変換 (Number Theoretic Transform)
PRIM_ROOTはPの原始根。
Implementations§
Source§impl<P: PrimeMod> NTT<P>
impl<P: PrimeMod> NTT<P>
Sourcepub fn ntt(&self, f: &mut [ConstModInt<P>])
pub fn ntt(&self, f: &mut [ConstModInt<P>])
数論変換を行う。
Sourcepub fn intt(&self, f: &mut [ConstModInt<P>])
pub fn intt(&self, f: &mut [ConstModInt<P>])
nttの逆変換を行う。
Sourcepub fn convolve<T>(&self, f: Vec<T>, g: Vec<T>) -> Vec<ConstModInt<P>>where
T: Into<ConstModInt<P>>,
pub fn convolve<T>(&self, f: Vec<T>, g: Vec<T>) -> Vec<ConstModInt<P>>where
T: Into<ConstModInt<P>>,
2つのVecを畳み込む。
$(f \ast g)(k) = \sum_{k = i + j} f(i) \times g(j)$
Sourcepub fn convolve_same(&self, f: Vec<ConstModInt<P>>) -> Vec<ConstModInt<P>>
pub fn convolve_same(&self, f: Vec<ConstModInt<P>>) -> Vec<ConstModInt<P>>
convolve(f.clone(), f)と同等。
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for NTT<P>
impl<P> RefUnwindSafe for NTT<P>where
P: RefUnwindSafe,
impl<P> Send for NTT<P>where
P: Send,
impl<P> Sync for NTT<P>where
P: Sync,
impl<P> Unpin for NTT<P>where
P: Unpin,
impl<P> UnwindSafe for NTT<P>where
P: 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