90 const Fr& nu_challenge,
91 const Fr& r_challenge)
93 const Fr& inverse_vanishing_eval_pos = inverted_vanishing_evals[0];
94 const Fr& inverse_vanishing_eval_neg = inverted_vanishing_evals[1];
98 unshifted->scalar = inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg;
103 r_challenge.invert() * (inverse_vanishing_eval_pos - nu_challenge * inverse_vanishing_eval_neg);
108 (inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg);
118 Fr r_shift_pos =
Fr(1);
119 Fr r_shift_neg =
Fr(1);
120 interleaved->shplonk_denominator = inverted_vanishing_evals[interleaving_denominator_index];
126 r_shift_pos *= r_challenge;
127 r_shift_neg *= (-r_challenge);
146 std::vector<Fr>& scalars,
147 Fr& batched_evaluation,
150 Fr shplonk_batching_pos = { 0 },
151 Fr shplonk_batching_neg = { 0 })
155 auto aggregate_claim_data_and_update_batched_evaluation = [&](
const Batch& batch,
Fr& rho_power) {
156 for (
auto [commitment, evaluation] :
zip_view(batch.commitments, batch.evaluations)) {
157 commitments.emplace_back(
std::move(commitment));
158 scalars.emplace_back(-batch.scalar * rho_power);
159 batched_evaluation += evaluation * rho_power;
168 aggregate_claim_data_and_update_batched_evaluation(*
unshifted, rho_power);
172 aggregate_claim_data_and_update_batched_evaluation(*
shifted, rho_power);
183 size_t group_idx = 0;
184 for (
size_t j = 0; j <
interleaved->commitments_groups.size(); j++) {
190 scalars.emplace_back(-rho_power *
interleaved->shplonk_denominator *
191 (shplonk_batching_pos *
interleaved->scalars_pos[i] +
192 shplonk_batching_neg *
interleaved->scalars_neg[i]));
194 batched_evaluation +=
interleaved->evaluations[group_idx] * rho_power;
195 if (j !=
interleaved->commitments_groups.size() - 1) {
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
typename Group::affine_element AffineElement
constexpr T get_msb(const T in)
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
RefVector< Commitment > commitments
RefVector< Fr > evaluations
RefVector< Fr > evaluations
std::vector< Fr > scalars_pos
std::vector< Fr > scalars_neg
std::vector< RefVector< Commitment > > commitments_groups
Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.
std::optional< Batch > unshifted
uint32_t k_shift_magnitude
std::optional< Batch > shifted
uint32_t get_groups_to_be_interleaved_size()
void compute_scalars_for_each_batch(std::span< const Fr > inverted_vanishing_evals, const Fr &nu_challenge, const Fr &r_challenge)
Compute scalars used to batch each set of claims, excluding contribution from batching challenge \rho...
typename Curve::ScalarField Fr
Batch get_right_shifted_by_k()
void update_batch_mul_inputs_and_batched_evaluation(std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &batched_evaluation, const Fr &rho, Fr &rho_power, Fr shplonk_batching_pos={ 0 }, Fr shplonk_batching_neg={ 0 })
Append the commitments and scalars from each batch of claims to the Shplemini, vectors which subseque...
InterleavedBatch get_interleaved()
std::optional< Batch > right_shifted_by_k
std::optional< InterleavedBatch > interleaved
Fr get_unshifted_batch_scalar() const
typename Curve::AffineElement Commitment
void throw_or_abort(std::string const &err)