Skip to main content

ntt_batch_scalar

Function ntt_batch_scalar 

Source
fn ntt_batch_scalar<M>(a: &mut [MInt<M>], width: usize)
Examples found in repository?
crates/competitive/src/math/number_theoretic_transform.rs (line 237)
233fn ntt_scalar<M>(a: &mut [MInt<M>])
234where
235    M: Montgomery32NttModulus,
236{
237    ntt_batch_scalar(a, 1);
238}
239
240fn ntt_batch<M>(a: &mut [MInt<M>], width: usize)
241where
242    M: Montgomery32NttModulus,
243{
244    #[cfg(target_arch = "x86_64")]
245    {
246        match batch_ntt_simd_backend(a.len(), width) {
247            SimdBackend::Avx512 => {
248                // SAFETY: backend detection checked all required AVX-512 features.
249                unsafe { ntt_simd::ntt_batch_avx512(a, width) };
250                return;
251            }
252            SimdBackend::Avx2 => {
253                // SAFETY: backend detection checked AVX2.
254                unsafe { ntt_simd::ntt_batch_avx2::<_, false>(a, width) };
255                return;
256            }
257            SimdBackend::Scalar => {}
258        }
259    }
260    ntt_batch_scalar(a, width);
261}