91 const Fr& nu_challenge,
92 const Fr& r_challenge)
94 const Fr& inverse_vanishing_eval_pos = inverted_vanishing_evals[0];
95 const Fr& inverse_vanishing_eval_neg = inverted_vanishing_evals[1];
99 unshifted->scalar = inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg;
104 r_challenge.invert() * (inverse_vanishing_eval_pos - nu_challenge * inverse_vanishing_eval_neg);
109 (inverse_vanishing_eval_pos + nu_challenge * inverse_vanishing_eval_neg);
119 Fr r_shift_pos =
Fr(1);
120 Fr r_shift_neg =
Fr(1);
121 interleaved->shplonk_denominator = inverted_vanishing_evals[interleaving_denominator_index];
127 r_shift_pos *= r_challenge;
128 r_shift_neg *= (-r_challenge);
147 std::vector<Fr>& scalars,
148 Fr& batched_evaluation,
151 Fr shplonk_batching_pos = { 0 },
152 Fr shplonk_batching_neg = { 0 })
156 auto aggregate_claim_data_and_update_batched_evaluation = [&](
const Batch& batch,
Fr& rho_power) {
157 for (
auto [commitment, evaluation] :
zip_view(batch.commitments, batch.evaluations)) {
158 commitments.emplace_back(
std::move(commitment));
159 scalars.emplace_back(-batch.scalar * rho_power);
160 batched_evaluation += evaluation * rho_power;
169 aggregate_claim_data_and_update_batched_evaluation(*
unshifted, rho_power);
173 aggregate_claim_data_and_update_batched_evaluation(*
shifted, rho_power);
184 size_t group_idx = 0;
185 for (
size_t j = 0; j <
interleaved->commitments_groups.size(); j++) {
191 scalars.emplace_back(-rho_power *
interleaved->shplonk_denominator *
192 (shplonk_batching_pos *
interleaved->scalars_pos[i] +
193 shplonk_batching_neg *
interleaved->scalars_neg[i]));
195 batched_evaluation +=
interleaved->evaluations[group_idx] * rho_power;
196 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)