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