/// On input a list of labeled polynomials and a query set, `open` outputs a proof of evaluation
/// of the polynomials at the points in the query set.
On input a list of labeled polynomials and a query set, `open` outputs a proof of evaluation
of the polynomials at the points in the query set.
On input a list of labeled polynomials and a query set ` open ` outputs a proof of evaluation of the polynomials at the points in the query set .
fn batch_open<'a>(
        ck: &CommitterKey<E>,
        labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>,
        commitments: impl IntoIterator<Item = &'a LabeledCommitment<Commitment<E>>>,
        query_set: &QuerySet<P::Point>,
        opening_challenges: &mut ChallengeGenerator<E::Fr, S>,
        rands: impl IntoIterator<Item = &'a Self::Randomness>,
        rng: Option<&mut dyn RngCore>,
    ) -> Result<Vec<kzg10::Proof<E>>, Error>
    where
        P: 'a,
        Self::Randomness: 'a,
        Self::Commitment: 'a,
    {
        let rng = &mut crate::optional_rng::OptionalRng(rng);
        let poly_rand_comm: BTreeMap<_, _> = labeled_polynomials
            .into_iter()
            .zip(rands)
            .zip(commitments.into_iter())
            .map(|((poly, r), comm)| (poly.label(), (poly, r, comm)))
            .collect();
        let open_time = start_timer!(|| format!(
            "Opening {} polynomials at query set of size {}",
            poly_rand_comm.len(),
            query_set.len(),
        ));
        let mut query_to_labels_map = BTreeMap::new();
        for (label, (point_label, point)) in query_set.iter() {
            let labels = query_to_labels_map
                .entry(point_label)
                .or_insert((point, BTreeSet::new()));
            labels.1.insert(label);
        }
        let mut proofs = Vec::new();
        for (_point_label, (point, labels)) in query_to_labels_map.into_iter() {
            let mut query_polys: Vec<&'a LabeledPolynomial<_, _>> = Vec::new();
            let mut query_rands: Vec<&'a Self::Randomness> = Vec::new();
            let mut query_comms: Vec<&'a LabeledCommitment<Self::Commitment>> = Vec::new();
            for label in labels {
                let (polynomial, rand, comm) =
                    poly_rand_comm.get(&label).ok_or(Error::MissingPolynomial {
                        label: label.to_string(),
                    })?;
                query_polys.push(polynomial);
                query_rands.push(rand);
                query_comms.push(comm);
            }
            let proof_time = start_timer!(|| "Creating proof");
            let proof = Self::open(
                ck,
                query_polys,
                query_comms,
                point,
                opening_challenges,
                query_rands,
                Some(rng),
            )?;
            end_timer!(proof_time);
            proofs.push(proof);
        }
        end_timer!(open_time);
        Ok(proofs.into())
    }
fn batch_open < ' a > ( ck : & CommitterKey < E > , labeled_polynomials : impl IntoIterator < Item = & ' a LabeledPolynomial < E :: Fr , P > > , commitments : impl IntoIterator < Item = & ' a LabeledCommitment < Commitment < E > > > , query_set : & QuerySet < P :: Point > , opening_challenges : & mut ChallengeGenerator < E :: Fr , S > , rands : impl IntoIterator < Item = & ' a Self :: Randomness > , rng : Option < & mut dyn RngCore > , ) -> Result < Vec < kzg10 :: Proof < E > > , Error > where P : ' a , Self :: Randomness : ' a , Self :: Commitment : ' a , { let rng = & mut crate :: optional_rng :: OptionalRng ( rng ) ; let poly_rand_comm : BTreeMap < _ , _ > = labeled_polynomials . into_iter ( ) . zip ( rands ) . zip ( commitments . into_iter ( ) ) . map ( | ( ( poly , r ) , comm ) | ( poly . label ( ) , ( poly , r , comm ) ) ) . collect ( ) ; let open_time = start_timer ! ( format ( " " poly_rand_comm len ( ) query_set len ( ) ) ) ; let mut query_to_labels_map = BTreeMap :: new ( ) ; for ( label , ( point_label , point ) ) in query_set . iter ( ) { let labels = query_to_labels_map . entry ( point_label ) . or_insert ( ( point , BTreeSet :: new ( ) ) ) ; labels . 1 . insert ( label ) ; } let mut proofs = Vec :: new ( ) ; for ( _point_label , ( point , labels ) ) in query_to_labels_map . into_iter ( ) { let mut query_polys : Vec < & ' a LabeledPolynomial < _ , _ > > = Vec :: new ( ) ; let mut query_rands : Vec < & ' a Self :: Randomness > = Vec :: new ( ) ; let mut query_comms : Vec < & ' a LabeledCommitment < Self :: Commitment > > = Vec :: new ( ) ; for label in labels { let ( polynomial , rand , comm ) = poly_rand_comm . get ( & label ) . ok_or ( Error :: MissingPolynomial { label : label . to_string ( ) , } ) ? ; query_polys . push ( polynomial ) ; query_rands . push ( rand ) ; query_comms . push ( comm ) ; } let proof_time = start_timer ! ( " " ) ; let proof = Self :: open ( ck , query_polys , query_comms , point , opening_challenges , query_rands , Some ( rng ) , ) ? ; end_timer ! ( proof_time ) ; proofs . push ( proof ) ; } end_timer ! ( open_time ) ; Ok ( proofs . into ( ) ) }
On input a list of labeled polynomials and a query set, `open` outputs a proof of evaluation
of the polynomials at the points in the query set.
On input a list of labeled polynomials and a query set ` open ` outputs a proof of evaluation of the polynomials at the points in the query set .
ck
&CommitterKey<E>
labeled_polynomials
impl IntoIterator<Item = &'a LabeledPolynomial<E::Fr, P>>
commitments
impl IntoIterator<Item = &'a LabeledCommitment<Commitment<E>>>
query_set
&QuerySet<P::Point>
opening_challenges
&mut ChallengeGenerator<E::Fr, S>
rands
impl IntoIterator<Item = &'a Self::Randomness>
rng
Option<&mut dyn RngCore>