ModuleHomomorphism

Trait ModuleHomomorphism 

Source
pub trait ModuleHomomorphism: Send + Sync {
    type Source: Module;
    type Target: Module<Algebra = <Self::Source as Module>::Algebra>;

Show 15 methods // Required methods fn source(&self) -> Arc<Self::Source>; fn target(&self) -> Arc<Self::Target>; fn degree_shift(&self) -> i32; fn apply_to_basis_element( &self, result: FpSliceMut<'_>, coeff: u32, input_degree: i32, input_idx: usize, ); // Provided methods fn kernel(&self, degree: i32) -> Option<&Subspace> { ... } fn quasi_inverse(&self, degree: i32) -> Option<&QuasiInverse> { ... } fn image(&self, degree: i32) -> Option<&Subspace> { ... } fn compute_auxiliary_data_through_degree(&self, degree: i32) { ... } fn apply( &self, result: FpSliceMut<'_>, coeff: u32, input_degree: i32, input: FpSlice<'_>, ) { ... } fn prime(&self) -> ValidPrime { ... } fn min_degree(&self) -> i32 { ... } fn auxiliary_data(&self, degree: i32) -> (Subspace, Subspace, QuasiInverse) { ... } fn get_matrix(&self, matrix: MatrixSliceMut<'_>, degree: i32) { ... } fn get_partial_matrix(&self, degree: i32, inputs: &[usize]) -> Matrix { ... } fn apply_quasi_inverse( &self, result: FpSliceMut<'_>, degree: i32, input: FpSlice<'_>, ) -> bool { ... }
}
Expand description

A trait that represents a homomorphism between two modules.

Each ModuleHomomorphism may come with auxiliary data, namely the kernel, image and quasi_inverse at each degree (the quasi-inverse is a map that is a right inverse when restricted to the image). These are computed via ModuleHomomorphism::compute_auxiliary_data_through_degree and retrieved through ModuleHomomorphism::kernel, ModuleHomomorphism::quasi_inverse and ModuleHomomorphism::image.

Note that an instance of a ModuleHomomorphism need not have the data available, even after compute_auxiliary_data_through_degree is invoked.

Required Associated Types§

Source

type Source: Module

Source

type Target: Module<Algebra = <Self::Source as Module>::Algebra>

Required Methods§

Source

fn source(&self) -> Arc<Self::Source>

Source

fn target(&self) -> Arc<Self::Target>

Source

fn degree_shift(&self) -> i32

Source

fn apply_to_basis_element( &self, result: FpSliceMut<'_>, coeff: u32, input_degree: i32, input_idx: usize, )

Calling this function when input_idx < source().dimension(input_degree) results in undefined behaviour. Implementations are encouraged to panic when this happens (this is usually the case because of out-of-bounds errors.

Provided Methods§

Source

fn kernel(&self, degree: i32) -> Option<&Subspace>

Source

fn quasi_inverse(&self, degree: i32) -> Option<&QuasiInverse>

Source

fn image(&self, degree: i32) -> Option<&Subspace>

Source

fn compute_auxiliary_data_through_degree(&self, degree: i32)

Source

fn apply( &self, result: FpSliceMut<'_>, coeff: u32, input_degree: i32, input: FpSlice<'_>, )

Source

fn prime(&self) -> ValidPrime

Source

fn min_degree(&self) -> i32

Source

fn auxiliary_data(&self, degree: i32) -> (Subspace, Subspace, QuasiInverse)

Compute the auxiliary data associated to the homomorphism at input degree degree. Returns it in the order image, kernel, quasi_inverse

Source

fn get_matrix(&self, matrix: MatrixSliceMut<'_>, degree: i32)

Write the matrix of the homomorphism at input degree degree to matrix.

The (sliced) dimensions of matrix must be equal to source_dimension x target_dimension

Source

fn get_partial_matrix(&self, degree: i32, inputs: &[usize]) -> Matrix

Get the values of the homomorphism on the specified inputs to matrix.

Source

fn apply_quasi_inverse( &self, result: FpSliceMut<'_>, degree: i32, input: FpSlice<'_>, ) -> bool

Attempt to apply quasi inverse to the input. Returns whether the operation was successful. This is required to either always succeed or always fail for each degree.

Implementors§