Trait LinearEncode

Source
pub trait LinearEncode<F, C, P, H>
where F: PrimeField, C: Config, H: CRHScheme, P: Polynomial<F>,
{ type LinCodePCParams: PCUniversalParams + PCCommitterKey + PCVerifierKey + LinCodeParametersInfo<C, H> + Sync; // Required methods fn setup<R: RngCore>( max_degree: usize, num_vars: Option<usize>, rng: &mut R, leaf_hash_param: <<C as Config>::LeafHash as CRHScheme>::Parameters, two_to_one_hash_param: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters, col_hash_params: H::Parameters, ) -> Self::LinCodePCParams; fn encode(msg: &[F], param: &Self::LinCodePCParams) -> Result<Vec<F>, Error>; fn poly_to_vec(polynomial: &P) -> Vec<F>; fn point_to_vec(point: P::Point) -> Vec<F>; fn tensor(z: &P::Point, n: usize, m: usize) -> (Vec<F>, Vec<F>); // Provided method fn compute_matrices( polynomial: &P, param: &Self::LinCodePCParams, ) -> (Matrix<F>, Matrix<F>) { ... } }
Expand description

A trait for linear codes.

Required Associated Types§

Source

type LinCodePCParams: PCUniversalParams + PCCommitterKey + PCVerifierKey + LinCodeParametersInfo<C, H> + Sync

For schemes like Brakedown and Ligero, PCCommiiterKey and PCVerifierKey and PCUniversalParams are all the same.

Required Methods§

Source

fn setup<R: RngCore>( max_degree: usize, num_vars: Option<usize>, rng: &mut R, leaf_hash_param: <<C as Config>::LeafHash as CRHScheme>::Parameters, two_to_one_hash_param: <<C as Config>::TwoToOneHash as TwoToOneCRHScheme>::Parameters, col_hash_params: H::Parameters, ) -> Self::LinCodePCParams

Does a default setup for the PCS.

Source

fn encode(msg: &[F], param: &Self::LinCodePCParams) -> Result<Vec<F>, Error>

Encode a message, which is interpreted as a vector of coefficients of a polynomial of degree m - 1.

Source

fn poly_to_vec(polynomial: &P) -> Vec<F>

Represent the polynomial as either coefficients, in the univariate case, or evaluations over the Boolean hypercube, in the multilinear case.

Source

fn point_to_vec(point: P::Point) -> Vec<F>

Represent the query point as a vector of Field elements.

Source

fn tensor(z: &P::Point, n: usize, m: usize) -> (Vec<F>, Vec<F>)

Tensor the query point z in the following sense: For a polynomial p(X) represented by a matrix M with n rows and m columns such that M_{i,j} = p_{i + n*j}, we define the tensoring of z: (a, b) = tensor(z, n, m) such that: p(z) = b^T.M.a returns the evaluation of p at z.

Provided Methods§

Source

fn compute_matrices( polynomial: &P, param: &Self::LinCodePCParams, ) -> (Matrix<F>, Matrix<F>)

Arrange the coefficients of the polynomial into a matrix, and apply encoding to each row. Returns the tuple (original_matrix, encoded_matrix).

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§

Source§

impl<F, C, P, H> LinearEncode<F, C, P, H> for MultilinearBrakedown<F, C, P, H>
where F: PrimeField, C: Config, P: MultilinearExtension<F>, <P as Polynomial<F>>::Point: Into<Vec<F>>, H: CRHScheme,

Source§

impl<F, C, P, H> LinearEncode<F, C, P, H> for MultilinearLigero<F, C, P, H>
where F: PrimeField + FftField, C: Config, P: MultilinearExtension<F>, <P as Polynomial<F>>::Point: Into<Vec<F>>, H: CRHScheme,

Source§

impl<F, C, P, H> LinearEncode<F, C, P, H> for UnivariateLigero<F, C, P, H>
where F: PrimeField, C: Config, P: DenseUVPolynomial<F>, P::Point: Into<F>, H: CRHScheme,