pub trait DynConvolutionAlgorithm<R>{
// Required methods
fn compute_convolution_dyn(
&self,
lhs: &[R::Element],
rhs: &[R::Element],
dst: &mut [R::Element],
ring: &R,
);
fn supports_ring_dyn(&self, ring: &R) -> bool;
}Expand description
Trait for algorithms that compute convolutions. This mirrors
ConvolutionAlgorithm, but is dyn-compatible. This is useful
if you want to create a ring but only know the type of the
convolution algorithm at runtime.
Wrap a dyn DynConvolutionAlgorithm<R> in DynConvolutionAlgorithmConvolution
to use it as a ConvolutionAlgorithm.
Required Methods§
Sourcefn compute_convolution_dyn(
&self,
lhs: &[R::Element],
rhs: &[R::Element],
dst: &mut [R::Element],
ring: &R,
)
fn compute_convolution_dyn( &self, lhs: &[R::Element], rhs: &[R::Element], dst: &mut [R::Element], ring: &R, )
Computes dst[i] += sum_j lhs[j] * rhs[i - j], where the sum runs over
these indices that do not cause an out-of-bounds.
For implementation purposes, we requrie dst.len() >= lhs.len() + rhs.len()
(not only dst.len() >= lhs.len() + rhs.len() - 1, which would be enough to
include lhs[lhs.len() - 1] * rhs[rhs.len() - 1]).