Function fold_interleaved_chunk

Source
pub fn fold_interleaved_chunk<F, FS, P, NTT>(
    ntt: &NTT,
    log_len: usize,
    log_batch_size: usize,
    chunk_index: usize,
    values: &[P],
    tensor: &[P],
    fold_challenges: &[F],
    scratch_buffer: &mut [F],
) -> F
where F: BinaryField + ExtensionField<FS>, FS: BinaryField, NTT: AdditiveNTT<FS>, P: PackedField<Scalar = F>,
Expand description

Calculate the fold of an interleaved chunk of values with random folding challenges.

The elements in the values vector are the interleaved cosets of a batch of codewords at the index coset_index. That is, the layout of elements in the values slice is

[a0, b0, c0, d0, a1, b1, c1, d1, ...]

where a0, a1, ... form a coset of a codeword a, b0, b1, ... form a coset of a codeword b, and similarly for c and d.

The fold operation first folds the adjacent symbols in the slice using regular multilinear tensor folding for the symbols from different cosets and FRI folding for the cosets themselves using the remaining challenges. NB: This method is on a hot path and does not perform any allocations or precondition checks.

See DP24, Def. 3.6 and Lemma 3.9 for more details.