ConvolveSteps

Trait ConvolveSteps 

Source
pub trait ConvolveSteps {
    type T;
    type F;

    // Required methods
    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);

    // Provided method
    fn convolve(a: Self::T, b: Self::T) -> Self::T { ... }
}

Required Associated Types§

Source

type T

Source

type F

Required Methods§

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)

Provided Methods§

Source

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

Examples found in repository?
crates/competitive/src/math/formal_power_series/formal_power_series_nums.rs (line 200)
199    fn mul(self, rhs: Self) -> Self::Output {
200        Self::from_vec(C::convolve(self.data, rhs.data))
201    }
More examples
Hide additional examples
crates/competitive/src/math/relaxed_convolution.rs (line 75)
72    fn calc_block(&mut self, la: usize, lb: usize, size: usize) {
73        let a = self.a[la..la + size].to_vec();
74        let b = self.b[lb..lb + size].to_vec();
75        let c = C::convolve(a, b);
76        for (c, d) in zip(c, &mut self.c[la + lb..]) {
77            *d += c;
78        }
79    }
crates/library_checker/src/convolution/convolution_mod.rs (line 13)
9pub fn convolution_mod(reader: impl Read, mut writer: impl Write) {
10    let s = read_all_unchecked(reader);
11    let mut scanner = Scanner::new(&s);
12    scan!(scanner, n, m, a: [MInt998244353; n], b: [MInt998244353; m]);
13    let c = Convolve998244353::convolve(a, b);
14    iter_print!(writer, @it c);
15}
crates/library_checker/src/set_power_series/subset_convolution.rs (line 14)
10pub fn subset_convolution(reader: impl Read, mut writer: impl Write) {
11    let s = read_all_unchecked(reader);
12    let mut scanner = Scanner::new(&s);
13    scan!(scanner, n, a: [MInt998244353; 1 << n], b: [MInt998244353; 1 << n]);
14    let c = SubsetConvolve::<AddMulOperation<_>>::convolve(a, b);
15    iter_print!(writer, @it c);
16}
crates/library_checker/src/convolution/convolution_mod_1000000007.rs (line 14)
9pub fn convolution_mod_1000000007(reader: impl Read, mut writer: impl Write) {
10    let s = read_all_unchecked(reader);
11    let mut scanner = Scanner::new(&s);
12    type M = MInt1000000007;
13    scan!(scanner, n, m, a: [M; n], b: [M; m]);
14    let c = MIntConvolve::<Modulo1000000007>::convolve(a, b);
15    iter_print!(writer, @it c);
16}
crates/library_checker/src/convolution/bitwise_and_convolution.rs (line 14)
10pub fn bitwise_and_convolution(reader: impl Read, mut writer: impl Write) {
11    let s = read_all_unchecked(reader);
12    let mut scanner = Scanner::new(&s);
13    scan!(scanner, n, a: [MInt998244353; 1 << n], b: [MInt998244353; 1 << n]);
14    let c = BitwiseandConvolve::<AddMulOperation<_>>::convolve(a, b);
15    iter_print!(writer, @it c);
16}
17
18#[verify::library_checker("bitwise_and_convolution")]
19pub fn bitwise_or_convolution(reader: impl Read, mut writer: impl Write) {
20    let s = read_all_unchecked(reader);
21    let mut scanner = Scanner::new(&s);
22    scan!(scanner, n, mut a: [MInt998244353; 1 << n], mut b: [MInt998244353; 1 << n]);
23    a.reverse();
24    b.reverse();
25    let mut c = BitwiseorConvolve::<AddMulOperation<_>>::convolve(a, b);
26    c.reverse();
27    iter_print!(writer, @it c);
28}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl ConvolveSteps for ConvolveRealFft

Source§

impl<M> ConvolveSteps for Convolve<M>

Source§

type T = Vec<MInt<M>>

Source§

type F = Vec<MInt<M>>

Source§

impl<M, N1, N2, N3> ConvolveSteps for Convolve<(M, (N1, N2, N3))>

Source§

type T = Vec<MInt<M>>

Source§

type F = (Vec<MInt<N1>>, Vec<MInt<N2>>, Vec<MInt<N3>>)

Source§

impl<N1, N2, N3> ConvolveSteps for Convolve<(u64, (N1, N2, N3))>

Source§

type T = Vec<u64>

Source§

type F = (Vec<MInt<N1>>, Vec<MInt<N2>>, Vec<MInt<N3>>)

Source§

impl<R> ConvolveSteps for BitwiseandConvolve<R>
where R: Ring<T: PartialEq, Additive: Invertible>,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for BitwiseorConvolve<R>
where R: Ring<T: PartialEq, Additive: Invertible>,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for BitwisexorConvolve<R, false>
where R: Field<T: PartialEq + From<usize>, Additive: Invertible, Multiplicative: Invertible>,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for BitwisexorConvolve<R, true>
where R: Field<T: PartialEq + TryFrom<usize>, Additive: Invertible, Multiplicative: Invertible>, <R::T as TryFrom<usize>>::Error: Debug,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for GcdConvolve<R>
where R: Ring<Additive: Invertible>,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for LcmConvolve<R>
where R: Ring<Additive: Invertible>,

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for SubsetConvolve<R>
where R: Ring<T: PartialEq, Additive: Invertible>,

Source§

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

Source§

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