pub trait ConvolutionAlgorithm<R: ?Sized + RingBase> {
    // Required method
    fn compute_convolution<V1: VectorView<R::Element>, V2: VectorView<R::Element>>(
        &self,
        lhs: V1,
        rhs: V2,
        dst: &mut [R::Element],
        ring: &R,
    );
}
Expand description

Trait for objects that can compute a convolution over a fixed ring.

§Availability

This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.

Required Methods§

source

fn compute_convolution<V1: VectorView<R::Element>, V2: VectorView<R::Element>>( &self, lhs: V1, rhs: V2, dst: &mut [R::Element], ring: &R, )

Elementwise adds the convolution of lhs and rhs to dst.

In other words, computes dst[i] += sum_j lhs[j] * rhs[i - j] for all i, where j runs through all positive integers for which lhs[j] and rhs[i - j] are defined, i.e. not out-of-bounds.

In particular, it is necessary that dst.len() >= lhs.len() + rhs.len() - 1. However, to allow for more efficient implementations, it is instead required that dst.len() >= lhs.len() + rhs.len().

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, R: ?Sized + RingBase, C: ConvolutionAlgorithm<R>> ConvolutionAlgorithm<R> for &'a C

source§

fn compute_convolution<V1: VectorView<R::Element>, V2: VectorView<R::Element>>( &self, lhs: V1, rhs: V2, dst: &mut [R::Element], ring: &R, )

Implementors§