Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
combiner.test.cpp
Go to the documentation of this file.
6#include <gtest/gtest.h>
7
8using namespace bb;
9
12using FF = typename Flavor::FF;
13
24class PGInternalTest : public ProtogalaxyProverInternal<ProverInstance_<Flavor>> {
25 public:
27 typename Flavor::template ProverUnivariates<ExtendedUnivariate::LENGTH>;
28
32
38 const ProverInstances& keys,
39 const GateSeparatorPolynomial<FF>& gate_separators,
40 const UnivariateRelationParametersNoOptimisticSkipping& relation_parameters,
42 {
45 keys, gate_separators, relation_parameters, alphas, accumulators);
46 }
47
60 const ProverInstances& keys,
61 const GateSeparatorPolynomial<FF>& gate_separators,
62 const UnivariateRelationParametersNoOptimisticSkipping& relation_parameters,
65 {
66 BB_BENCH();
67
68 // Determine the number of threads over which to distribute the work
69 // The polynomial size is given by the virtual size since the computation includes
70 // the incoming key which could have nontrivial values on the larger domain in case of overflow.
71 const size_t common_polynomial_size = keys[0]->polynomials.w_l.virtual_size();
72 const size_t num_threads = compute_num_threads(common_polynomial_size);
73
74 // Univariates are optimized for usual PG, but we need the unoptimized version for tests (it's a version that
75 // doesn't skip computation), so we need to define types depending on the template instantiation
76 using ThreadAccumulators = TupleOfTuplesOfUnivariatesNoOptimisticSkipping;
77 // Construct univariate accumulator containers; one per thread
78 // Note: std::vector will trigger {}-initialization of the contents. Therefore no need to zero the univariates.
79 std::vector<ThreadAccumulators> thread_univariate_accumulators(num_threads);
80
81 // Distribute the execution trace rows across threads so that each handles an equal number of active rows
82 trace_usage_tracker.construct_thread_ranges(num_threads, common_polynomial_size);
83
84 // Accumulate the contribution from each sub-relation
85 parallel_for(num_threads, [&](size_t thread_idx) {
86 // Construct extended univariates containers; one per thread
88
90 for (size_t idx = range.first; idx < range.second; idx++) {
91 // Instantiate univariates, possibly with skipping toto ignore computation in those indices (they
92 // are still available for skipping relations, but all derived univariate will ignore those
93 // evaluations) No need to initialize extended_univariates to 0, as it's assigned to.
94 constexpr size_t skip_count = 0;
95 extend_univariates<skip_count>(extended_univariates, keys, idx);
96
97 const FF pow_challenge = gate_separators[idx];
98
99 // Accumulate the i-th row's univariate contribution. Note that the relation parameters passed to
100 // this function have already been folded. Moreover, linear-dependent relations that act over the
101 // entire execution trace rather than on rows, will not be multiplied by the pow challenge.
103 thread_univariate_accumulators[thread_idx],
104 extended_univariates,
105 relation_parameters, // these parameters have already been folded
106 pow_challenge);
107 }
108 }
109 });
110
111 RelationUtils::zero_univariates(univariate_accumulators);
112 // Accumulate the per-thread univariate accumulators into a single set of accumulators
113 for (auto& accumulators : thread_univariate_accumulators) {
114 RelationUtils::add_nested_tuples(univariate_accumulators, accumulators);
115 }
116 // This does nothing if TupleOfTuples is TupleOfTuplesOfUnivariates
117 TupleOfTuplesOfUnivariatesNoOptimisticSkipping deoptimized_univariates =
118 deoptimize_univariates(univariate_accumulators);
119 // Batch the univariate contributions from each sub-relation to obtain the round univariate
120 return batch_over_relations(deoptimized_univariates, alphas);
121 }
122
136 template <size_t relation_idx = 0>
138 TupleOfTuplesOfUnivariatesNoOptimisticSkipping& univariate_accumulators,
139 const ExtendedUnivariatesTypeNoOptimisticSkipping& extended_univariates,
140 const UnivariateRelationParametersNoOptimisticSkipping& relation_parameters,
141 const FF& scaling_factor)
142 {
144
145 // Check if the relation is skippable to speed up accumulation
146 if constexpr (!isSkippable<Relation, decltype(extended_univariates)>) {
147 // If not, accumulate normally
148 Relation::accumulate(std::get<relation_idx>(univariate_accumulators),
149 extended_univariates,
150 relation_parameters,
151 scaling_factor);
152 } else {
153 // If so, only compute the contribution if the relation is active
154 if (!Relation::skip(extended_univariates)) {
155 Relation::accumulate(std::get<relation_idx>(univariate_accumulators),
156 extended_univariates,
157 relation_parameters,
158 scaling_factor);
159 }
160 }
161
162 // Repeat for the next relation.
163 if constexpr (relation_idx + 1 < Flavor::NUM_RELATIONS) {
164 accumulate_relation_univariates_no_optimistic_skipping<relation_idx + 1>(
165 univariate_accumulators, extended_univariates, relation_parameters, scaling_factor);
166 }
167 }
168};
169// TODO(https://github.com/AztecProtocol/barretenberg/issues/780): Improve combiner tests to check more than the
170// arithmetic relation so we more than unit test folding relation parameters and alpha as well.
171TEST(Protogalaxy, CombinerOn2Keys)
172{
174
175 const auto restrict_to_standard_arithmetic_relation = [](auto& polys) {
176 std::fill(polys.q_arith.coeffs().begin(), polys.q_arith.coeffs().end(), 1);
177 std::fill(polys.q_delta_range.coeffs().begin(), polys.q_delta_range.coeffs().end(), 0);
178 std::fill(polys.q_elliptic.coeffs().begin(), polys.q_elliptic.coeffs().end(), 0);
179 std::fill(polys.q_memory.coeffs().begin(), polys.q_memory.coeffs().end(), 0);
180 std::fill(polys.q_nnf.coeffs().begin(), polys.q_nnf.coeffs().end(), 0);
181 std::fill(polys.q_lookup.coeffs().begin(), polys.q_lookup.coeffs().end(), 0);
182 std::fill(polys.q_4.coeffs().begin(), polys.q_4.coeffs().end(), 0);
183 std::fill(polys.q_poseidon2_external.coeffs().begin(), polys.q_poseidon2_external.coeffs().end(), 0);
184 std::fill(polys.q_poseidon2_internal.coeffs().begin(), polys.q_poseidon2_internal.coeffs().end(), 0);
185 std::fill(polys.w_4.coeffs().begin(), polys.w_4.coeffs().end(), 0);
186 std::fill(polys.w_4_shift.coeffs().begin(), polys.w_4_shift.coeffs().end(), 0);
187 };
188
189 auto run_test = [&](bool is_random_input) {
190 PGInternalTest pg_internal; // instance of the PG internal prover
191
192 // Combiner test on prover polynomials containing random values, restricted to only the standard arithmetic
193 // relation.
194 if (is_random_input) {
195 std::array<std::shared_ptr<ProverInstance>, bb::NUM_INSTANCES> keys;
196
197 for (size_t idx = 0; idx < bb::NUM_INSTANCES; idx++) {
199 auto prover_polynomials = get_sequential_prover_polynomials<Flavor>(
200 /*log_circuit_size=*/1, idx * 128);
201 restrict_to_standard_arithmetic_relation(prover_polynomials);
202 key->polynomials = std::move(prover_polynomials);
203 key->set_dyadic_size(2);
204 keys[idx] = key;
205 }
206
208 alphas.fill(bb::Univariate<FF, 12>(FF(0))); // focus on the arithmetic relation only
209 GateSeparatorPolynomial<FF> gate_separators({ 2 }, /*log_num_monomials=*/1);
210 PGInternalTest::UnivariateRelationParametersNoOptimisticSkipping univariate_relation_parameters_no_skpping;
211 auto result_no_skipping = pg_internal.compute_combiner_no_optimistic_skipping(
212 keys, gate_separators, univariate_relation_parameters_no_skpping, alphas);
213 // The expected_result values are computed by running the python script combiner_example_gen.py
215 14414024UL,
216 79442504UL,
217 232846280UL,
218 512374088UL,
219 955774664UL,
220 1600796744UL,
221 2485189064UL,
222 3646700360UL,
223 5123079368UL,
224 6952074824UL,
225 9171435464UL });
226 EXPECT_EQ(result_no_skipping, expected_result);
227 } else {
228 std::array<std::shared_ptr<ProverInstance>, bb::NUM_INSTANCES> keys;
229
230 for (size_t idx = 0; idx < bb::NUM_INSTANCES; idx++) {
232 auto prover_polynomials = get_zero_prover_polynomials<Flavor>(
233 /*log_circuit_size=*/1);
234 restrict_to_standard_arithmetic_relation(prover_polynomials);
235 key->polynomials = std::move(prover_polynomials);
236 key->set_dyadic_size(2);
237 keys[idx] = key;
238 }
239
241 alphas.fill(bb::Univariate<FF, 12>(FF(0))); // focus on the arithmetic relation only
242
243 const auto create_add_gate = [](auto& polys, const size_t idx, FF w_l, FF w_r) {
244 polys.w_l.at(idx) = w_l;
245 polys.w_r.at(idx) = w_r;
246 polys.w_o.at(idx) = w_l + w_r;
247 polys.q_l.at(idx) = 1;
248 polys.q_r.at(idx) = 1;
249 polys.q_o.at(idx) = -1;
250 };
251
252 const auto create_mul_gate = [](auto& polys, const size_t idx, FF w_l, FF w_r) {
253 polys.w_l.at(idx) = w_l;
254 polys.w_r.at(idx) = w_r;
255 polys.w_o.at(idx) = w_l * w_r;
256 polys.q_m.at(idx) = 1;
257 polys.q_o.at(idx) = -1;
258 };
259
260 create_add_gate(keys[0]->polynomials, 0, 1, 2);
261 create_add_gate(keys[0]->polynomials, 1, 0, 4);
262 create_add_gate(keys[1]->polynomials, 0, 3, 4);
263 create_mul_gate(keys[1]->polynomials, 1, 1, 4);
264
265 restrict_to_standard_arithmetic_relation(keys[0]->polynomials);
266 restrict_to_standard_arithmetic_relation(keys[1]->polynomials);
267
268 /* ProverInstance 0 ProverInstance 1
269 w_l w_r w_o q_m q_l q_r q_o q_c w_l w_r w_o q_m q_l q_r q_o q_c
270 1 2 3 0 1 1 -1 0 3 4 7 0 1 1 -1 0
271 0 4 4 0 1 1 -1 0 1 4 4 1 0 0 -1 0 */
272
273 /* Lagrange-combined values, row index 0 Lagrange-combined values, row index 1
274 in 0 1 2 3 4 5 6 in 0 1 2 3 4 5 6
275 w_l 1 3 5 7 9 11 13 w_l 0 1 2 3 4 5 6
276 w_r 2 4 6 8 10 12 14 w_r 4 4 4 4 4 4 4
277 w_o 3 7 11 15 19 23 27 w_o 4 4 4 4 4 4 0
278 q_m 0 0 0 0 0 0 0 q_m 0 1 2 3 4 5 6
279 q_l 1 1 1 1 1 1 1 q_l 1 0 -1 -2 -3 -4 -5
280 q_r 1 1 1 1 1 1 1 q_r 1 0 -1 -2 -3 -4 -5
281 q_o -1 -1 -1 -1 -1 -1 -1 q_o -1 -1 -1 -1 -1 -1 -1
282 q_c 0 0 0 0 0 0 0 q_c 0 0 0 0 0 0 0
283
284 relation value:
285 0 0 0 0 0 0 0 0 0 6 18 36 60 90 */
286
287 GateSeparatorPolynomial<FF> gate_separators({ 2 }, /*log_num_monomials=*/1);
288 PGInternalTest::UnivariateRelationParametersNoOptimisticSkipping univariate_relation_parameters_no_skipping;
289 PGInternalTest::UnivariateRelationParameters univariate_relation_parameters;
290 auto result_no_skipping = pg_internal.compute_combiner_no_optimistic_skipping(
291 keys, gate_separators, univariate_relation_parameters_no_skipping, alphas);
292 // Note: {} is required to initialize the tuple contents. Otherwise the univariates contain garbage.
294 auto result_with_skipping = pg_internal.compute_combiner(
295 keys, gate_separators, univariate_relation_parameters, alphas, accumulators);
296 auto expected_result =
297 Univariate<FF, 12>(std::array<FF, 12>{ 0, 0, 12, 36, 72, 120, 180, 252, 336, 432, 540, 660 });
298
299 EXPECT_EQ(result_no_skipping, expected_result);
300 EXPECT_EQ(result_with_skipping, expected_result);
301 }
302 };
303 run_test(true);
304 run_test(false);
305};
306
307// Check that the optimized combiner computation yields a result consistent with the unoptimized version
308TEST(Protogalaxy, CombinerOptimizationConsistency)
309{
312
313 constexpr size_t UNIVARIATE_LENGTH = 12;
314 const auto restrict_to_standard_arithmetic_relation = [](auto& polys) {
315 std::fill(polys.q_arith.coeffs().begin(), polys.q_arith.coeffs().end(), 1);
316 std::fill(polys.q_delta_range.coeffs().begin(), polys.q_delta_range.coeffs().end(), 0);
317 std::fill(polys.q_elliptic.coeffs().begin(), polys.q_elliptic.coeffs().end(), 0);
318 std::fill(polys.q_memory.coeffs().begin(), polys.q_memory.coeffs().end(), 0);
319 std::fill(polys.q_nnf.coeffs().begin(), polys.q_nnf.coeffs().end(), 0);
320 std::fill(polys.q_lookup.coeffs().begin(), polys.q_lookup.coeffs().end(), 0);
321 std::fill(polys.q_4.coeffs().begin(), polys.q_4.coeffs().end(), 0);
322 std::fill(polys.w_4.coeffs().begin(), polys.w_4.coeffs().end(), 0);
323 std::fill(polys.w_4_shift.coeffs().begin(), polys.w_4_shift.coeffs().end(), 0);
324 };
325
326 auto run_test = [&](bool is_random_input) {
327 PGInternalTest pg_internal; // instance of the PG internal prover
328
329 // Combiner test on prover polynomisls containing random values, restricted to only the standard arithmetic
330 // relation.
331 if (is_random_input) {
332 std::array<std::shared_ptr<ProverInstance>, bb::NUM_INSTANCES> keys;
333
334 for (size_t idx = 0; idx < bb::NUM_INSTANCES; idx++) {
336 auto prover_polynomials = get_sequential_prover_polynomials<Flavor>(
337 /*log_circuit_size=*/1, idx * 128);
338 restrict_to_standard_arithmetic_relation(prover_polynomials);
339 key->polynomials = std::move(prover_polynomials);
340 key->set_dyadic_size(2);
341 keys[idx] = key;
342 }
343
345 alphas.fill(bb::Univariate<FF, UNIVARIATE_LENGTH>(FF(0))); // focus on the arithmetic relation only
346 GateSeparatorPolynomial<FF> gate_separators({ 2 }, /*log_num_monomials=*/1);
347
348 // Relation parameters are all zeroes
349 RelationParameters<FF> relation_parameters;
350 // Temporary accumulator to compute the sumcheck on the second key
351 // Note: {} is required to initialize the tuple contents. Otherwise the values contain garbage.
352 using TupleOfArraysOfValues = decltype(create_tuple_of_arrays_of_values<typename Flavor::Relations>());
353 TupleOfArraysOfValues temporary_accumulator{};
354
355 // Accumulate arithmetic relation over 2 rows on the second key
356 for (size_t i = 0; i < 2; i++) {
357 UltraArithmeticRelation::accumulate(std::get<0>(temporary_accumulator),
358 keys[bb::NUM_INSTANCES - 1]->polynomials.get_row(i),
359 relation_parameters,
360 gate_separators[i]);
361 }
362 // Get the result of the 0th subrelation of the arithmetic relation
363 FF key_offset = std::get<0>(temporary_accumulator)[0];
364 // Subtract it from q_c[0] (it directly affect the target sum, making it zero and enabling the optimisation)
365 keys[1]->polynomials.q_c.at(0) -= key_offset;
367 extended_polynomials; // These hold the extensions of prover polynomials
368
369 // Manually extend all polynomials. Create new ProverPolynomials from extended values
370 for (size_t idx = bb::NUM_INSTANCES; idx < UNIVARIATE_LENGTH; idx++) {
371
373 auto prover_polynomials = get_zero_prover_polynomials<Flavor>(1);
374 for (auto [key_0_polynomial, key_1_polynomial, new_polynomial] :
375 zip_view(keys[0]->polynomials.get_all(),
376 keys[1]->polynomials.get_all(),
377 prover_polynomials.get_all())) {
378 for (size_t i = 0; i < /*circuit_size*/ 2; i++) {
379 new_polynomial.at(i) =
380 key_0_polynomial[i] + ((key_1_polynomial[i] - key_0_polynomial[i]) * idx);
381 }
382 }
383 extended_polynomials.push_back(std::move(prover_polynomials));
384 }
385 std::array<FF, UNIVARIATE_LENGTH> precomputed_result{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
386 // Compute the sum for each index separately, treating each extended key independently
387 for (size_t idx = 0; idx < UNIVARIATE_LENGTH; idx++) {
388 // Note: {} is required to initialize the tuple contents. Otherwise the values contain garbage.
389 TupleOfArraysOfValues accumulator{};
390 if (idx < bb::NUM_INSTANCES) {
391 for (size_t i = 0; i < 2; i++) {
392 UltraArithmeticRelation::accumulate(std::get<0>(accumulator),
393 keys[idx]->polynomials.get_row(i),
394 relation_parameters,
395 gate_separators[i]);
396 }
397 } else {
398 for (size_t i = 0; i < 2; i++) {
399 UltraArithmeticRelation::accumulate(std::get<0>(accumulator),
400 extended_polynomials[idx - bb::NUM_INSTANCES].get_row(i),
401 relation_parameters,
402 gate_separators[i]);
403 }
404 }
405 precomputed_result[idx] = std::get<0>(accumulator)[0];
406 }
407 auto expected_result = Univariate<FF, UNIVARIATE_LENGTH>(precomputed_result);
408 PGInternalTest::UnivariateRelationParametersNoOptimisticSkipping univariate_relation_parameters_no_skpping;
409 PGInternalTest::UnivariateRelationParameters univariate_relation_parameters;
410 auto result_no_skipping = pg_internal.compute_combiner_no_optimistic_skipping(
411 keys, gate_separators, univariate_relation_parameters_no_skpping, alphas);
412 // Note: {} is required to initialize the tuple contents. Otherwise the univariates contain garbage.
414 auto result_with_skipping = pg_internal.compute_combiner(
415 keys, gate_separators, univariate_relation_parameters, alphas, accumulators);
416
417 EXPECT_EQ(result_no_skipping, expected_result);
418 EXPECT_EQ(result_with_skipping, expected_result);
419 } else {
420 std::array<std::shared_ptr<ProverInstance>, bb::NUM_INSTANCES> keys;
421
422 for (size_t idx = 0; idx < bb::NUM_INSTANCES; idx++) {
424 auto prover_polynomials = get_zero_prover_polynomials<Flavor>(
425 /*log_circuit_size=*/1);
426 restrict_to_standard_arithmetic_relation(prover_polynomials);
427 key->polynomials = std::move(prover_polynomials);
428 key->set_dyadic_size(2);
429 keys[idx] = key;
430 }
431
433 alphas.fill(bb::Univariate<FF, 12>(FF(0))); // focus on the arithmetic relation only
434
435 const auto create_add_gate = [](auto& polys, const size_t idx, FF w_l, FF w_r) {
436 polys.w_l.at(idx) = w_l;
437 polys.w_r.at(idx) = w_r;
438 polys.w_o.at(idx) = w_l + w_r;
439 polys.q_l.at(idx) = 1;
440 polys.q_r.at(idx) = 1;
441 polys.q_o.at(idx) = -1;
442 };
443
444 const auto create_mul_gate = [](auto& polys, const size_t idx, FF w_l, FF w_r) {
445 polys.w_l.at(idx) = w_l;
446 polys.w_r.at(idx) = w_r;
447 polys.w_o.at(idx) = w_l * w_r;
448 polys.q_m.at(idx) = 1;
449 polys.q_o.at(idx) = -1;
450 };
451
452 create_add_gate(keys[0]->polynomials, 0, 1, 2);
453 create_add_gate(keys[0]->polynomials, 1, 0, 4);
454 create_add_gate(keys[1]->polynomials, 0, 3, 4);
455 create_mul_gate(keys[1]->polynomials, 1, 1, 4);
456
457 restrict_to_standard_arithmetic_relation(keys[0]->polynomials);
458 restrict_to_standard_arithmetic_relation(keys[1]->polynomials);
459
460 /* ProverInstance 0 ProverInstance 1
461 w_l w_r w_o q_m q_l q_r q_o q_c w_l w_r w_o q_m q_l q_r q_o q_c
462 1 2 3 0 1 1 -1 0 3 4 7 0 1 1 -1 0
463 0 4 4 0 1 1 -1 0 1 4 4 1 0 0 -1 0 */
464
465 /* Lagrange-combined values, row index 0 Lagrange-combined values, row index 1
466 in 0 1 2 3 4 5 6 in 0 1 2 3 4 5 6
467 w_l 1 3 5 7 9 11 13 w_l 0 1 2 3 4 5 6
468 w_r 2 4 6 8 10 12 14 w_r 4 4 4 4 4 4 4
469 w_o 3 7 11 15 19 23 27 w_o 4 4 4 4 4 4 0
470 q_m 0 0 0 0 0 0 0 q_m 0 1 2 3 4 5 6
471 q_l 1 1 1 1 1 1 1 q_l 1 0 -1 -2 -3 -4 -5
472 q_r 1 1 1 1 1 1 1 q_r 1 0 -1 -2 -3 -4 -5
473 q_o -1 -1 -1 -1 -1 -1 -1 q_o -1 -1 -1 -1 -1 -1 -1
474 q_c 0 0 0 0 0 0 0 q_c 0 0 0 0 0 0 0
475
476 relation value:
477 0 0 0 0 0 0 0 0 0 6 18 36 60 90 */
478
479 GateSeparatorPolynomial<FF> gate_separators({ 2 }, /*log_num_monomials=*/1);
480 PGInternalTest::UnivariateRelationParametersNoOptimisticSkipping univariate_relation_parameters_no_skpping;
481 PGInternalTest::UnivariateRelationParameters univariate_relation_parameters;
482 auto result_no_skipping = pg_internal.compute_combiner_no_optimistic_skipping(
483 keys, gate_separators, univariate_relation_parameters_no_skpping, alphas);
484 // Note: {} is required to initialize the tuple contents. Otherwise the univariates contain garbage.
486 auto result_with_skipping = pg_internal.compute_combiner(
487 keys, gate_separators, univariate_relation_parameters, alphas, accumulators);
488 auto expected_result =
489 Univariate<FF, 12>(std::array<FF, 12>{ 0, 0, 12, 36, 72, 120, 180, 252, 336, 432, 540, 660 });
490
491 EXPECT_EQ(result_no_skipping, expected_result);
492 EXPECT_EQ(result_with_skipping, expected_result);
493 }
494 };
495 run_test(true);
496 run_test(false);
497};
#define BB_BENCH()
Definition bb_bench.hpp:222
Extend the ProtogalaxyProverInternal class to compute the combiner without optimistically skipping.
static BB_INLINE void accumulate_relation_univariates_no_optimistic_skipping(TupleOfTuplesOfUnivariatesNoOptimisticSkipping &univariate_accumulators, const ExtendedUnivariatesTypeNoOptimisticSkipping &extended_univariates, const UnivariateRelationParametersNoOptimisticSkipping &relation_parameters, const FF &scaling_factor)
Add the value of each relation over univariates to an appropriate accumulator.
typename Flavor::template ProverUnivariates< ExtendedUnivariate::LENGTH > ExtendedUnivariatesNoOptimisticSkipping
ExtendedUnivariateWithRandomization compute_combiner_no_optimistic_skipping(const ProverInstances &keys, const GateSeparatorPolynomial< FF > &gate_separators, const UnivariateRelationParametersNoOptimisticSkipping &relation_parameters, const UnivariateSubrelationSeparators &alphas, TupleOfTuplesOfUnivariatesNoOptimisticSkipping &univariate_accumulators)
Compute the combiner polynomial $G$ in the Protogalaxy paper.
ExtendedUnivariateWithRandomization compute_combiner_no_optimistic_skipping(const ProverInstances &keys, const GateSeparatorPolynomial< FF > &gate_separators, const UnivariateRelationParametersNoOptimisticSkipping &relation_parameters, const UnivariateSubrelationSeparators &alphas)
Compute combiner using univariates that do not avoid zero computation in case of valid incoming indic...
std::conditional_t< Flavor::USE_SHORT_MONOMIALS, ShortUnivariates, ExtendedUnivariatesNoOptimisticSkipping > ExtendedUnivariatesTypeNoOptimisticSkipping
static constexpr size_t NUM_RELATIONS
Curve::ScalarField FF
bb::Polynomial< FF > Polynomial
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
A purely static class (never add state to this!) consisting of functions used by the Protogalaxy prov...
ExtendedUnivariateWithRandomization compute_combiner(const ProverInstances &instances, const GateSeparatorPolynomial< FF > &gate_separators, const UnivariateRelationParameters &relation_parameters, const UnivariateSubrelationSeparators &alphas, TupleOfTuplesOfUnivariates &univariate_accumulators)
Compute the combiner polynomial in the Protogalaxy paper.
std::array< Univariate< FF, BATCHED_EXTENDED_LENGTH >, NUM_SUBRELATIONS - 1 > UnivariateSubrelationSeparators
static size_t compute_num_threads(const size_t domain_size)
Determine number of threads for multithreading of perterbator/combiner operations.
static TupleOfTuplesOfUnivariatesNoOptimisticSkipping deoptimize_univariates(const TupleOfTuplesOfUnivariatePossiblyOptimistic &tup)
Convert univariates from optimized form to regular.
typename Flavor::template ProtogalaxyTupleOfTuplesOfUnivariates< NUM_INSTANCES > TupleOfTuplesOfUnivariates
static ExtendedUnivariateWithRandomization batch_over_relations(TupleOfTuplesOfUnivariatesNoOptimisticSkipping &univariate_accumulators, const UnivariateSubrelationSeparators &alphas)
Given the univariate accumulators and the batching challenges, compute the combiner by batching the s...
typename Flavor::template ProtogalaxyTupleOfTuplesOfUnivariatesNoOptimisticSkipping< NUM_INSTANCES > TupleOfTuplesOfUnivariatesNoOptimisticSkipping
std::array< std::shared_ptr< ProverInstance_< Flavor > >, NUM_INSTANCES > ProverInstances
A ProverInstance is normally constructed from a finalized circuit and it contains all the information...
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static void zero_univariates(auto &tuple)
Set all coefficients of Univariates to zero.
Definition utils.hpp:61
static constexpr void add_nested_tuples(Tuple &tuple_1, const Tuple &tuple_2)
Componentwise addition of nested tuples (tuples of tuples)
Definition utils.hpp:117
#define BB_INLINE
bool expected_result
Entry point for Barretenberg command-line interface.
typename Flavor::FF FF
TEST(BoomerangMegaCircuitBuilder, BasicCircuit)
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
Definition thread.cpp:111
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::vector< std::vector< Range > > thread_ranges
void construct_thread_ranges(const size_t num_threads, const size_t full_domain_size, bool use_prev_accumulator=false)
Construct ranges of execution trace rows that evenly distribute the active content of the trace acros...
Implementation of the methods for the -polynomials used in in Sumcheck.
Container for parameters used by the grand product (permutation, lookup) Honk relations.