pub fn new_time<const N: usize, const M: usize>(
        transcript: &mut Transcript,
        ck: &CommitterKey<E>,
        base_polynomials: [&Vec<E::Fr>; N],
        body_polynomials: [(&[&Vec<E::Fr>], &[E::Fr]); M],
    ) -> TensorcheckProof<E> {
        let max_len = body_polynomials
            .iter()
            .map(|x| x.0.len())
            .fold(0, usize::max);

        let batch_challenge = transcript.get_challenge::<E::Fr>(b"batch_challenge");
        let batch_challenges = powers(batch_challenge, max_len);

        let batched_body_polynomials = body_polynomials.iter().map(|(polynomials, challenges)| {
            (
                linear_combination(polynomials, &batch_challenges).expect(EMPTY_CHALLENGES_ERR_MSG),
                challenges,
            )
        });

        let foldings_body_polynomials = batched_body_polynomials
            .flat_map(|(polynomial, challenges)| foldings_polynomial(&polynomial, challenges))
            .collect::<Vec<_>>();
        let folded_polynomials_commitments = ck.batch_commit(&foldings_body_polynomials);

        // add commitments to transcript
        folded_polynomials_commitments
            .iter()
            .for_each(|c| transcript.append_commitment(b"commitment", c));
        let eval_chal = transcript.get_challenge::<E::Fr>(b"evaluation-chal");
        let minus_eval_chal = -eval_chal;
        let eval_chal2 = eval_chal.square();

        let base_polynomials_evaluations = base_polynomials
            .iter()
            .map(|polynomial| {
                [
                    evaluate_le(polynomial, &eval_chal2),
                    evaluate_le(polynomial, &eval_chal),
                    evaluate_le(polynomial, &minus_eval_chal),
                ]
            })
            .collect::<Vec<_>>();

        let folded_polynomials_evaluations = foldings_body_polynomials
            .iter()
            .map(|polynomial| {
                [
                    evaluate_le(polynomial.borrow(), &eval_chal),
                    evaluate_le(polynomial.borrow(), &minus_eval_chal),
                ]
            })
            .collect::<Vec<_>>();

        let mut all_polynomials = base_polynomials.to_vec();
        all_polynomials.extend(foldings_body_polynomials.iter());

        // add all evaluations to the transcript
        base_polynomials_evaluations
            .iter()
            .flatten()
            .for_each(|e| transcript.append_scalar(b"eval", e));
        folded_polynomials_evaluations
            .iter()
            .flatten()
            .for_each(|e| transcript.append_scalar(b"eval", e));
        let open_chal = transcript.get_challenge::<E::Fr>(b"open-chal");

        let evaluation_proof = ck.batch_open_multi_points(
            &all_polynomials[..],
            &[eval_chal2, eval_chal, minus_eval_chal],
            &open_chal,
        );

        Self {
            base_polynomials_evaluations,
            folded_polynomials_evaluations,
            evaluation_proof,
            folded_polynomials_commitments,
        }
    }
/// The function for construct tensor check proof in a time-efficient way.
///
/// It takes as input the randomness generator `transcript`, the committer key `ck`,
/// the `base_polynomials` and the folded polynomials `body_polynomials`.
///
/// The `base_polynomials` are part of polynomials that are evaluated at a tensor point.
///
/// The folded polynomials `body_polynomials` consist of multiple tensor check intance.
/// Each instance contains a set of folded polynomials and folding randomnesses.
The function for construct tensor check proof in a time-efficient way.

The `base_polynomials` are part of polynomials that are evaluated at a tensor point.

The folded polynomials `body_polynomials` consist of multiple tensor check intance.
Each instance contains a set of folded polynomials and folding randomnesses.
The function for construct tensor check proof in a time - efficient way . The ` base_polynomials ` are part of polynomials that are evaluated at a tensor point . The folded polynomials ` body_polynomials ` consist of multiple tensor check intance . Each instance contains a set of folded polynomials and folding randomnesses .
pub fn new_time<const N: usize, const M: usize>(
        transcript: &mut Transcript,
        ck: &CommitterKey<E>,
        base_polynomials: [&Vec<E::Fr>; N],
        body_polynomials: [(&[&Vec<E::Fr>], &[E::Fr]); M],
    ) -> TensorcheckProof<E> {
        let max_len = body_polynomials
            .iter()
            .map(|x| x.0.len())
            .fold(0, usize::max);
        let batch_challenge = transcript.get_challenge::<E::Fr>(b"batch_challenge");
        let batch_challenges = powers(batch_challenge, max_len);
        let batched_body_polynomials = body_polynomials.iter().map(|(polynomials, challenges)| {
            (
                linear_combination(polynomials, &batch_challenges).expect(EMPTY_CHALLENGES_ERR_MSG),
                challenges,
            )
        });
        let foldings_body_polynomials = batched_body_polynomials
            .flat_map(|(polynomial, challenges)| foldings_polynomial(&polynomial, challenges))
            .collect::<Vec<_>>();
        let folded_polynomials_commitments = ck.batch_commit(&foldings_body_polynomials);
        // add commitments to transcript
        folded_polynomials_commitments
            .iter()
            .for_each(|c| transcript.append_commitment(b"commitment", c));
        let eval_chal = transcript.get_challenge::<E::Fr>(b"evaluation-chal");
        let minus_eval_chal = -eval_chal;
        let eval_chal2 = eval_chal.square();
        let base_polynomials_evaluations = base_polynomials
            .iter()
            .map(|polynomial| {
                [
                    evaluate_le(polynomial, &eval_chal2),
                    evaluate_le(polynomial, &eval_chal),
                    evaluate_le(polynomial, &minus_eval_chal),
                ]
            })
            .collect::<Vec<_>>();
        let folded_polynomials_evaluations = foldings_body_polynomials
            .iter()
            .map(|polynomial| {
                [
                    evaluate_le(polynomial.borrow(), &eval_chal),
                    evaluate_le(polynomial.borrow(), &minus_eval_chal),
                ]
            })
            .collect::<Vec<_>>();
        let mut all_polynomials = base_polynomials.to_vec();
        all_polynomials.extend(foldings_body_polynomials.iter());
        // add all evaluations to the transcript
        base_polynomials_evaluations
            .iter()
            .flatten()
            .for_each(|e| transcript.append_scalar(b"eval", e));
        folded_polynomials_evaluations
            .iter()
            .flatten()
            .for_each(|e| transcript.append_scalar(b"eval", e));
        let open_chal = transcript.get_challenge::<E::Fr>(b"open-chal");
        let evaluation_proof = ck.batch_open_multi_points(
            &all_polynomials[..],
            &[eval_chal2, eval_chal, minus_eval_chal],
            &open_chal,
        );
        Self {
            base_polynomials_evaluations,
            folded_polynomials_evaluations,
            evaluation_proof,
            folded_polynomials_commitments,
        }
    }
pub fn new_time < const N : usize , const M : usize > ( transcript : & mut Transcript , ck : & CommitterKey < E > , base_polynomials : [ & Vec < E :: Fr > ; N ] , body_polynomials : [ ( & [ & Vec < E :: Fr > ] , & [ E :: Fr ] ) ; M ] , ) -> TensorcheckProof < E > { let max_len = body_polynomials . iter ( ) . map ( | x | x . 0 . len ( ) ) . fold ( 0 , usize :: max ) ; let batch_challenge = transcript . get_challenge :: < E :: Fr > ( b" " ) ; let batch_challenges = powers ( batch_challenge , max_len ) ; let batched_body_polynomials = body_polynomials . iter ( ) . map ( | ( polynomials , challenges ) | { ( linear_combination ( polynomials , & batch_challenges ) . expect ( EMPTY_CHALLENGES_ERR_MSG ) , challenges , ) } ) ; let foldings_body_polynomials = batched_body_polynomials . flat_map ( | ( polynomial , challenges ) | foldings_polynomial ( & polynomial , challenges ) ) . collect :: < Vec < _ > > ( ) ; let folded_polynomials_commitments = ck . batch_commit ( & foldings_body_polynomials ) ; // add commitments to transcript folded_polynomials_commitments . iter ( ) . for_each ( | c | transcript . append_commitment ( b" " , c ) ) ; let eval_chal = transcript . get_challenge :: < E :: Fr > ( b" " ) ; let minus_eval_chal = - eval_chal ; let eval_chal2 = eval_chal . square ( ) ; let base_polynomials_evaluations = base_polynomials . iter ( ) . map ( | polynomial | { [ evaluate_le ( polynomial , & eval_chal2 ) , evaluate_le ( polynomial , & eval_chal ) , evaluate_le ( polynomial , & minus_eval_chal ) , ] } ) . collect :: < Vec < _ > > ( ) ; let folded_polynomials_evaluations = foldings_body_polynomials . iter ( ) . map ( | polynomial | { [ evaluate_le ( polynomial . borrow ( ) , & eval_chal ) , evaluate_le ( polynomial . borrow ( ) , & minus_eval_chal ) , ] } ) . collect :: < Vec < _ > > ( ) ; let mut all_polynomials = base_polynomials . to_vec ( ) ; all_polynomials . extend ( foldings_body_polynomials . iter ( ) ) ; // add all evaluations to the transcript base_polynomials_evaluations . iter ( ) . flatten ( ) . for_each ( | e | transcript . append_scalar ( b" " , e ) ) ; folded_polynomials_evaluations . iter ( ) . flatten ( ) . for_each ( | e | transcript . append_scalar ( b" " , e ) ) ; let open_chal = transcript . get_challenge :: < E :: Fr > ( b" " ) ; let evaluation_proof = ck . batch_open_multi_points ( & all_polynomials [ .. ] , & [ eval_chal2 , eval_chal , minus_eval_chal ] , & open_chal , ) ; Self { base_polynomials_evaluations , folded_polynomials_evaluations , evaluation_proof , folded_polynomials_commitments , } }
The function for construct tensor check proof in a time-efficient way.
The function for construct tensor check proof in a time - efficient way .
transcript
&mut Transcript
ck
&CommitterKey<E>
base_polynomials
[&Vec<E::Fr>; N]
body_polynomials
[(&[&Vec<E::Fr>], &[E::Fr]); M]