Struct NTTConvolution

Source
pub struct NTTConvolution<R, A = Global>
where R: RingStore + Clone, R::Type: ZnRing, A: Allocator + Clone,
{ /* private fields */ }
Expand description

Computes the convolution over a finite field that has suitable roots of unity using a power-of-two length FFT (sometimes called Number-Theoretic Transform, NTT in this context).

§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.

Implementations§

Source§

impl<R, A> NTTConvolution<R, A>
where R: RingStore + Clone, R::Type: ZnRing, A: Allocator + Clone,

Source

pub fn new_with(ring: R, allocator: A) -> Self

§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.

Source

pub fn ring(&self) -> &R

§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.

Trait Implementations§

Source§

impl<R, A> ConvolutionAlgorithm<<R as RingStore>::Type> for NTTConvolution<R, A>
where R: RingStore + Clone, R::Type: ZnRing, A: Allocator + Clone,

Source§

fn supports_ring<S: RingStore<Type = R::Type> + Copy>(&self, ring: S) -> bool

Returns whether this convolution algorithm supports computations of the given ring. Read more
Source§

fn compute_convolution<S: RingStore<Type = R::Type> + Copy, V1: VectorView<<R::Type as RingBase>::Element>, V2: VectorView<<R::Type as RingBase>::Element>>( &self, lhs: V1, rhs: V2, dst: &mut [El<R>], ring: S, )

Elementwise adds the convolution of lhs and rhs to dst. Read more
Source§

fn specialize_prepared_convolution<F>(function: F) -> Result<F::Output, F>

If this convolution implements PreparedConvolutionAlgorithm, then the given function is called and its result is returned. Otherwise, Err is returned.
Source§

impl<R, A> PreparedConvolutionAlgorithm<<R as RingStore>::Type> for NTTConvolution<R, A>
where R: RingStore + Clone, R::Type: ZnRing, A: Allocator + Clone,

Source§

type PreparedConvolutionOperand = PreparedConvolutionOperand<R, A>

Source§

fn prepare_convolution_operand<S: RingStore<Type = R::Type> + Copy, V: VectorView<El<R>>>( &self, val: V, ring: S, ) -> Self::PreparedConvolutionOperand

Source§

fn compute_convolution_lhs_prepared<S: RingStore<Type = R::Type> + Copy, V: VectorView<El<R>>>( &self, lhs: &Self::PreparedConvolutionOperand, rhs: V, dst: &mut [El<R>], ring: S, )

Source§

fn compute_convolution_prepared<S: RingStore<Type = R::Type> + Copy>( &self, lhs: &Self::PreparedConvolutionOperand, rhs: &Self::PreparedConvolutionOperand, dst: &mut [El<R>], ring: S, )

Source§

fn compute_convolution_inner_product_prepared<'a, S, I>( &self, values: I, dst: &mut [El<R>], ring: S, )
where S: RingStore<Type = R::Type> + Copy, I: Iterator<Item = (&'a Self::PreparedConvolutionOperand, &'a Self::PreparedConvolutionOperand)>, Self: 'a, R: 'a, PreparedConvolutionOperand<R, A>: 'a,

Source§

fn compute_convolution_rhs_prepared<S, V>( &self, lhs: V, rhs: &Self::PreparedConvolutionOperand, dst: &mut [R::Element], ring: S, )
where S: RingStore<Type = R> + Copy, V: VectorView<R::Element>,

Source§

fn compute_convolution_inner_product_lhs_prepared<'a, S, I, V>( &self, values: I, dst: &mut [R::Element], ring: S, )
where S: RingStore<Type = R> + Copy, I: Iterator<Item = (&'a Self::PreparedConvolutionOperand, V)>, V: VectorView<R::Element>, Self: 'a, R: 'a, Self::PreparedConvolutionOperand: 'a,

Auto Trait Implementations§

§

impl<R, A = Global> !Freeze for NTTConvolution<R, A>

§

impl<R, A = Global> !RefUnwindSafe for NTTConvolution<R, A>

§

impl<R, A> Send for NTTConvolution<R, A>
where R: Send, A: Send, <<R as RingStore>::Type as RingBase>::Element: Send,

§

impl<R, A> Sync for NTTConvolution<R, A>
where R: Sync + Send, A: Sync, <<R as RingStore>::Type as RingBase>::Element: Sync + Send,

§

impl<R, A> Unpin for NTTConvolution<R, A>
where R: Unpin, A: Unpin,

§

impl<R, A> UnwindSafe for NTTConvolution<R, A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.