Skip to main content

Encoder

Trait Encoder 

Source
pub trait Encoder<F: Field> {
    // Required method
    fn encode_batch(
        &self,
        message: RowMajorMatrix<F>,
        log_inv_rate: usize,
    ) -> RowMajorMatrix<F>;
}
Expand description

A linear code applied to every column of a matrix.

The blanket impl below covers every TwoAdicSubgroupDft, which restricts what an implementor may write: impl<F: Field> Encoder<F> for MyEncoder overlaps it and is rejected (E0119), since a downstream crate could implement TwoAdicSubgroupDft for MyEncoder. An impl must therefore name the concrete field(s) it encodes over, as in impl Encoder<MyField> for MyEncoder.

The randomized counterpart is p3_zk_codes::ZkEncoding, whose codewords additionally hide the message from a bounded number of queries.

Required Methods§

Source

fn encode_batch( &self, message: RowMajorMatrix<F>, log_inv_rate: usize, ) -> RowMajorMatrix<F>

Encodes each column of message into a codeword.

message has height 2^k; the result has the same width and height 2^(k + log_inv_rate). Output row i is codeword symbol i.

§Panics

Panics if the height of message is not a power of two, or if the codeword height 2^(k + log_inv_rate) overflows usize.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F: TwoAdicField, D: TwoAdicSubgroupDft<F>> Encoder<F> for D

Reed-Solomon over the two-adic subgroup of order 2^(k + log_inv_rate): each column of message is the low-degree coefficient vector of a polynomial, and the codeword is its evaluation vector on that subgroup.