pub trait LinearEncode<F, C, P, H>{
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§
Sourcetype LinCodePCParams: PCUniversalParams + PCCommitterKey + PCVerifierKey + LinCodeParametersInfo<C, H> + Sync
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§
Sourcefn 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 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.
Sourcefn encode(msg: &[F], param: &Self::LinCodePCParams) -> Result<Vec<F>, Error>
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.
Sourcefn poly_to_vec(polynomial: &P) -> Vec<F>
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.
Sourcefn point_to_vec(point: P::Point) -> Vec<F>
fn point_to_vec(point: P::Point) -> Vec<F>
Represent the query point as a vector of Field elements.
Sourcefn tensor(z: &P::Point, n: usize, m: usize) -> (Vec<F>, Vec<F>)
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§
Sourcefn compute_matrices(
polynomial: &P,
param: &Self::LinCodePCParams,
) -> (Matrix<F>, Matrix<F>)
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.