85 const Fr& nu_challenge,
86 const Fr& r_challenge)
88 const Fr& inverse_vanishing_eval_pos = inverted_vanishing_evals[0];
89 const Fr& inverse_vanishing_eval_neg = inverted_vanishing_evals[1];
93 unshifted->scalar = inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg;
98 r_challenge.invert() * (inverse_vanishing_eval_pos - nu_challenge * inverse_vanishing_eval_neg);
108 Fr r_shift_pos =
Fr(1);
109 Fr r_shift_neg =
Fr(1);
110 interleaved->shplonk_denominator = inverted_vanishing_evals[interleaving_denominator_index];
116 r_shift_pos *= r_challenge;
117 r_shift_neg *= (-r_challenge);
136 std::vector<Fr>& scalars,
137 Fr& batched_evaluation,
139 Fr shplonk_batching_pos = { 0 },
140 Fr shplonk_batching_neg = { 0 })
145 auto aggregate_claim_data_and_update_batched_evaluation = [&](
const Batch& batch,
Fr& rho_power) {
146 for (
auto [commitment, evaluation] :
zip_view(batch.commitments, batch.evaluations)) {
147 commitments.emplace_back(
std::move(commitment));
148 scalars.emplace_back(-batch.scalar * rho_power);
149 batched_evaluation += evaluation * rho_power;
158 aggregate_claim_data_and_update_batched_evaluation(*
unshifted, rho_power);
162 aggregate_claim_data_and_update_batched_evaluation(*
shifted, rho_power);
169 size_t group_idx = 0;
170 for (
size_t j = 0; j <
interleaved->commitments_groups.size(); j++) {
175 scalars.emplace_back(-rho_power *
interleaved->shplonk_denominator *
176 (shplonk_batching_pos *
interleaved->scalars_pos[i] +
177 shplonk_batching_neg *
interleaved->scalars_neg[i]));
179 batched_evaluation +=
interleaved->evaluations[group_idx] * rho_power;
180 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, shifted and interleaved polynomials in Shplem...
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)