86 const Fr& nu_challenge,
87 const Fr& r_challenge)
89 const Fr& inverse_vanishing_eval_pos = inverted_vanishing_evals[0];
90 const Fr& inverse_vanishing_eval_neg = inverted_vanishing_evals[1];
94 unshifted->scalar = inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg;
99 r_challenge.invert() * (inverse_vanishing_eval_pos - nu_challenge * inverse_vanishing_eval_neg);
109 Fr r_shift_pos =
Fr(1);
110 Fr r_shift_neg =
Fr(1);
111 interleaved->shplonk_denominator = inverted_vanishing_evals[interleaving_denominator_index];
117 r_shift_pos *= r_challenge;
118 r_shift_neg *= (-r_challenge);
137 std::vector<Fr>& scalars,
138 Fr& batched_evaluation,
140 Fr shplonk_batching_pos = { 0 },
141 Fr shplonk_batching_neg = { 0 })
146 auto aggregate_claim_data_and_update_batched_evaluation = [&](
const Batch& batch,
Fr& rho_power) {
147 for (
auto [commitment, evaluation] :
zip_view(batch.commitments, batch.evaluations)) {
148 commitments.emplace_back(
std::move(commitment));
149 scalars.emplace_back(-batch.scalar * rho_power);
150 batched_evaluation += evaluation * rho_power;
159 aggregate_claim_data_and_update_batched_evaluation(*
unshifted, rho_power);
163 aggregate_claim_data_and_update_batched_evaluation(*
shifted, rho_power);
170 size_t group_idx = 0;
171 for (
size_t j = 0; j <
interleaved->commitments_groups.size(); j++) {
177 scalars.emplace_back(-rho_power *
interleaved->shplonk_denominator *
178 (shplonk_batching_pos *
interleaved->scalars_pos[i] +
179 shplonk_batching_neg *
interleaved->scalars_neg[i]));
181 batched_evaluation +=
interleaved->evaluations[group_idx] * rho_power;
182 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
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
void update_batch_mul_inputs_and_batched_evaluation(std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &batched_evaluation, const Fr &rho, 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< InterleavedBatch > interleaved
Fr get_unshifted_batch_scalar() const
typename Curve::AffineElement Commitment
void throw_or_abort(std::string const &err)