/// Return the queried coset at `coset_index` of all oracles.
/// `result[i][j][k]` is coset index `i` -> oracle index `j` -> element `k`
/// in this coset.
Return the queried coset at `coset_index` of all oracles.
Return the queried coset at ` coset_index ` of all oracles .
pub fn query_coset(
        &self,
        coset_index: &[Vec<Boolean<CF>>],
        iop_messages: &mut MessagesCollectionVar<CF>,
    ) -> Result<CosetQueryResult<FpVar<CF>>, SynthesisError> {
        let constituent_oracle_handles = self.coset_evaluator.constituent_oracle_handles();
        let codeword_domain_var = Radix2DomainVar::new(
            self.codeword_domain.gen(),
            self.codeword_domain.dim() as u64,
            FpVar::Constant(self.codeword_domain.offset),
        )?;
        let constituent_oracles = constituent_oracle_handles // TODO: has bug here
            .into_iter()
            .map(|(round, idxes)| {
                // check idxes have unique elements
                debug_assert!(
                    idxes.iter().collect::<BTreeSet<_>>().len() == idxes.len(),
                    "idxes must be unique"
                );
                let query_responses = iop_messages.prover_round(round).query_coset(
                    &coset_index,
                    iop_trace!("constituent oracle for virtual oracle"),
                )?;
                Ok(query_responses.into_iter() // iterate over cosets
                    .map(|mut c| { // shape (num_oracles_in_this_round, num_elements_in_coset)
                        idxes.iter().map(|idx| take(&mut c[idx.idx])).collect::<Vec<_>>() // shape (num_oracles_needed_for_this_round, num_elements_in_coset)
                    }).collect::<Vec<_>>())
                // shape: (num_cosets, num_oracles_needed_for_this_round,
                // num_elements_in_coset)
            })
            .collect::<Result<Vec<_>, SynthesisError>>()?
            .into_iter()
            .fold(vec![vec![]; coset_index.len()], |mut acc, r| {
                // shape of r is (num_cosets, num_oracles_needed_for_this_round,
                // num_elements_in_coset) result shape: (num_cosets,
                // num_oracles_needed_for_all_rounds, num_elements_in_coset)
                acc.iter_mut().zip(r).for_each(|(a, r)| {
                    a.extend(r);
                });
                acc
            });
        // shape: (num_cosets, num_oracles_needed_for_all_rounds, num_elements_in_coset)
        let queried_cosets = coset_index
            .iter()
            .map(|i| {
                codeword_domain_var.query_position_to_coset(&i[..], self.localization_param as u64)
            })
            .collect::<Result<Vec<_>, SynthesisError>>()?;
        let query_result = constituent_oracles
            .into_iter()
            .zip(queried_cosets)
            .map(|(cons, coset)| self.coset_evaluator.evaluate_var(coset, &cons))
            .collect::<Result<Vec<Vec<_>>, SynthesisError>>()?;
        Ok(CosetQueryResult::from_single_oracle_result(query_result))
    }
pub fn query_coset ( & self , coset_index : & [ Vec < Boolean < CF > > ] , iop_messages : & mut MessagesCollectionVar < CF > , ) -> Result < CosetQueryResult < FpVar < CF > > , SynthesisError > { let constituent_oracle_handles = self . coset_evaluator . constituent_oracle_handles ( ) ; let codeword_domain_var = Radix2DomainVar :: new ( self . codeword_domain . gen ( ) , self . codeword_domain . dim ( ) as u64 , FpVar :: Constant ( self . codeword_domain . offset ) , ) ? ; let constituent_oracles = constituent_oracle_handles // TODO: has bug here . into_iter ( ) . map ( | ( round , idxes ) | { // check idxes have unique elements debug_assert ! ( idxes iter ( ) collect BTreeSet ( ) len ( ) idxes len ( ) " " ) ; let query_responses = iop_messages . prover_round ( round ) . query_coset ( & coset_index , iop_trace ! ( " " ) , ) ? ; Ok ( query_responses . into_iter ( ) // iterate over cosets . map ( | mut c | { // shape (num_oracles_in_this_round, num_elements_in_coset) idxes . iter ( ) . map ( | idx | take ( & mut c [ idx . idx ] ) ) . collect :: < Vec < _ > > ( ) // shape (num_oracles_needed_for_this_round, num_elements_in_coset) } ) . collect :: < Vec < _ > > ( ) ) // shape: (num_cosets, num_oracles_needed_for_this_round, // num_elements_in_coset) } ) . collect :: < Result < Vec < _ > , SynthesisError > > ( ) ? . into_iter ( ) . fold ( vec ! [ vec [ ] coset_index len ( ) ] , | mut acc , r | { // shape of r is (num_cosets, num_oracles_needed_for_this_round, // num_elements_in_coset) result shape: (num_cosets, // num_oracles_needed_for_all_rounds, num_elements_in_coset) acc . iter_mut ( ) . zip ( r ) . for_each ( | ( a , r ) | { a . extend ( r ) ; } ) ; acc } ) ; // shape: (num_cosets, num_oracles_needed_for_all_rounds, num_elements_in_coset) let queried_cosets = coset_index . iter ( ) . map ( | i | { codeword_domain_var . query_position_to_coset ( & i [ .. ] , self . localization_param as u64 ) } ) . collect :: < Result < Vec < _ > , SynthesisError > > ( ) ? ; let query_result = constituent_oracles . into_iter ( ) . zip ( queried_cosets ) . map ( | ( cons , coset ) | self . coset_evaluator . evaluate_var ( coset , & cons ) ) . collect :: < Result < Vec < Vec < _ > > , SynthesisError > > ( ) ? ; Ok ( CosetQueryResult :: from_single_oracle_result ( query_result ) ) }
Return the queried coset at `coset_index` of all oracles.
Return the queried coset at ` coset_index ` of all oracles .
&self
coset_index
&[Vec<Boolean<CF>>]
iop_messages
&mut MessagesCollectionVar<CF>