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 202)
201    fn mul(self, rhs: Self) -> Self::Output {
202        Self::from_vec(C::convolve(self.data, rhs.data))
203    }
More examples
Hide additional examples
crates/library_checker/src/math/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/math/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/math/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/math/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}
crates/library_checker/src/math/gcd_convolution.rs (line 16)
10pub fn gcd_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, mut a: [MInt998244353; n], mut b: [MInt998244353; n]);
14    a.insert(0, Default::default());
15    b.insert(0, Default::default());
16    let c = GcdConvolve::<AddMulOperation<_>>::convolve(a, b);
17    iter_print!(writer, @it &c[1..]);
18}

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>
where M: Montgomery32NttModulus,

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))>
where M: MIntConvert + MIntConvert<u32>, N1: Montgomery32NttModulus, N2: Montgomery32NttModulus, N3: Montgomery32NttModulus,

Source§

type T = Vec<MInt<M>>

Source§

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

Source§

impl<R> ConvolveSteps for BitwiseandConvolve<R>
where R: Ring, R::T: PartialEq, R::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, R::T: PartialEq, R::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>

Source§

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

Source§

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

Source§

impl<R> ConvolveSteps for BitwisexorConvolve<R, true>

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, R::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, R::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, R::T: PartialEq, R::Additive: Invertible,

Source§

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

Source§

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