pub struct NTT<const P: u32, const PRIM_ROOT: u32> { /* private fields */ }
Expand description
素数$P$上の数論変換 (Number Theoretic Transform)
PRIM_ROOT
はP
の原始根。
Implementations§
Source§impl<const P: u32, const PRIM_ROOT: u32> NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> NTT<P, PRIM_ROOT>
Sourcepub fn ntt(&self, f: &mut Vec<ConstModInt<P>>)
pub fn ntt(&self, f: &mut Vec<ConstModInt<P>>)
数論変換を行う。
Sourcepub fn intt(&self, f: &mut Vec<ConstModInt<P>>)
pub fn intt(&self, f: &mut Vec<ConstModInt<P>>)
ntt
の逆変換を行う。
Sourcepub fn convolve(
&self,
f: Vec<ConstModInt<P>>,
g: Vec<ConstModInt<P>>,
) -> Vec<ConstModInt<P>>
pub fn convolve( &self, f: Vec<ConstModInt<P>>, g: Vec<ConstModInt<P>>, ) -> Vec<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<const P: u32, const PRIM_ROOT: u32> Freeze for NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> RefUnwindSafe for NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> Send for NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> Sync for NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> Unpin for NTT<P, PRIM_ROOT>
impl<const P: u32, const PRIM_ROOT: u32> UnwindSafe for NTT<P, PRIM_ROOT>
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