pub trait LinearCode<Zt: ZipTypes>:
Debug
+ Clone
+ Eq
+ Sync
+ Send {
const REPETITION_FACTOR: usize;
// Required methods
fn row_len(&self) -> usize;
fn codeword_len(&self) -> usize;
fn params_string(&self) -> String;
fn encode(&self, row: &[Zt::Eval]) -> Vec<Zt::Cw>;
fn encode_wide(&self, row: &[Zt::CombR]) -> Vec<Zt::CombR>;
fn encode_f<F>(&self, row: &[F]) -> Vec<F>
where F: FromPrimitiveWithConfig + FromRef<F>;
}Required Associated Constants§
Sourceconst REPETITION_FACTOR: usize
const REPETITION_FACTOR: usize
Repetition factor, a.k.a. inverse rate, the ratio of codeword length to input row length. Has to be at a power of 2.
Note: Ideally, this should be a generic constant, but due to the fact that generic parameters may not be used in const operations, this makes using it too much of a hassle.
Required Methods§
Sourcefn codeword_len(&self) -> usize
fn codeword_len(&self) -> usize
Length of each encoded codeword (output length after encoding)
Sourcefn params_string(&self) -> String
fn params_string(&self) -> String
String representation of the parameters of this linear code, used for benchmarks. Should start with “row_len=X”.
Sourcefn encode(&self, row: &[Zt::Eval]) -> Vec<Zt::Cw>
fn encode(&self, row: &[Zt::Eval]) -> Vec<Zt::Cw>
Encodes a row of cryptographic integers using this linear encoding scheme.
This function is optimized for the prover’s context where we work with
cryptographic integers. It’s more efficient than encode_f as it
avoids field conversions.
§Parameters
row: Slice of cryptographic integers to encode
§Returns
A vector of cryptographic integers representing the encoded row
Sourcefn encode_wide(&self, row: &[Zt::CombR]) -> Vec<Zt::CombR>
fn encode_wide(&self, row: &[Zt::CombR]) -> Vec<Zt::CombR>
Encodes a row of cryptographic integers using this linear encoding scheme.
This function is optimized for the prover’s context where we work with
cryptographic integers. It’s more efficient than encode_f as it
avoids field conversions.
§Parameters
row: Slice of cryptographic integers to encode
§Returns
A vector of cryptographic integers representing the encoded row
Sourcefn encode_f<F>(&self, row: &[F]) -> Vec<F>where
F: FromPrimitiveWithConfig + FromRef<F>,
fn encode_f<F>(&self, row: &[F]) -> Vec<F>where
F: FromPrimitiveWithConfig + FromRef<F>,
Encodes a row of field elements using this linear encoding scheme.
This function is used when working with field elements directly and performs the encoding by first converting the sparse matrices to field elements.
§Parameters
row: Slice of field elements to encodefield: Field configuration for the conversion
§Returns
A vector of field elements representing the encoded row
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.