Convolution

Trait Convolution 

Source
pub trait Convolution<BE: Backend>{
    // Provided methods
    fn convolution_tmp_bytes(&self, res_size: usize) -> usize { ... }
    fn convolution<R, A, B>(
        &self,
        res: &mut R,
        res_scale: i64,
        a: &A,
        b: &B,
        scratch: &mut Scratch<BE>,
    )
       where R: VecZnxDftToMut<BE>,
             A: VecZnxToRef,
             B: VecZnxDftToRef<BE> { ... }
}

Provided Methods§

Source

fn convolution_tmp_bytes(&self, res_size: usize) -> usize

Source

fn convolution<R, A, B>( &self, res: &mut R, res_scale: i64, a: &A, b: &B, scratch: &mut Scratch<BE>, )
where R: VecZnxDftToMut<BE>, A: VecZnxToRef, B: VecZnxDftToRef<BE>,

Evaluates a bivariate convolution over Z[X, Y] / (X^N + 1) where Y = 2^-K and scales the result by 2^{res_scale * K}

§Example

a = [a00, a10, a20, a30] = (a00 * 2^-K + a01 * 2^-2K) + (a10 * 2^-K + a11 * 2^-2K) * X … [a01, a11, a21, a31]

b = [b00, b10, b20, b30] = (b00 * 2^-K + b01 * 2^-2K) + (b10 * 2^-K + b11 * 2^-2K) * X … [b01, b11, b21, b31]

If res_scale = 0: res = [ 0, 0, 0, 0] = (r01 * 2^-2K + r02 * 2^-3K + r03 * 2^-4K + r04 * 2^-5K) + … [r01, r11, r21, r31] [r02, r12, r22, r32] [r03, r13, r23, r33] [r04, r14, r24, r34]

If res_scale = 1: res = [r01, r11, r21, r31] = (r01 * 2^-K + r02 * 2^-2K + r03 * 2^-3K + r04 * 2^-4K + r05 * 2^-5K) + … [r02, r12, r22, r32] [r03, r13, r23, r33] [r04, r14, r24, r34] [r05, r15, r25, r35]

If res_scale = -1: res = [ 0, 0, 0, 0] = (r01 * 2^-3K + r02 * 2^-4K + r03 * 2^-5K) + … [ 0, 0, 0, 0] [r01, r11, r21, r31] [r02, r12, r22, r32] [r03, r13, r23, r33]

If res.size() < a.size() + b.size() + 1 + res_scale, result is truncated accordingly in the Y dimension.

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§