Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gate_separator.test.cpp
Go to the documentation of this file.
1
#include "
gate_separator.hpp
"
2
#include "
barretenberg/ecc/curves/bn254/fr.hpp
"
3
#include <gtest/gtest.h>
4
5
using namespace
bb
;
6
7
TEST
(
GateSeparatorPolynomial
, FullPowConsistency)
8
{
9
constexpr
size_t
d = 5;
10
std::vector<fr>
betas
(d);
11
for
(
auto
& beta :
betas
) {
12
beta =
fr::random_element
();
13
}
14
15
GateSeparatorPolynomial<fr>
poly(
betas
);
16
std::array<fr, d>
variables{};
17
for
(
auto
& u_i : variables) {
18
u_i =
fr::random_element
();
19
poly.
partially_evaluate
(u_i);
20
}
21
22
size_t
beta_idx = 0;
23
fr
expected_eval = 1;
24
for
(
auto
& u_i : variables) {
25
expected_eval *=
fr
(1) - u_i + u_i * poly.
betas
[beta_idx];
26
beta_idx++;
27
}
28
29
EXPECT_EQ(poly.
partial_evaluation_result
, expected_eval);
30
}
31
32
TEST
(
GateSeparatorPolynomial
, GateSeparatorPolynomialsOnPowers)
33
{
34
std::vector<fr>
betas
{ 2, 4, 16 };
35
GateSeparatorPolynomial<fr>
poly(
betas
,
betas
.size());
36
std::vector<fr> expected_values{ 1, 2, 4, 8, 16, 32, 64, 128 };
37
EXPECT_EQ(expected_values, poly.
beta_products
);
38
}
fr.hpp
gate_separator.hpp
betas
std::vector< FF > betas
The challenges .
Definition
gate_separator.hpp:22
bb
Entry point for Barretenberg command-line interface.
Definition
acir_format_getters.cpp:6
bb::TEST
TEST(MegaCircuitBuilder, CopyConstructor)
Definition
mega_circuit_builder.test.cpp:14
bb::fr
field< Bn254FrParams > fr
Definition
fr.hpp:174
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
bb::GateSeparatorPolynomial
Implementation of the methods for the -polynomials used in Protogalaxy and -polynomials used in Sumch...
Definition
gate_separator.hpp:17
bb::GateSeparatorPolynomial::beta_products
std::vector< FF > beta_products
The consecutive evaluations for identified with the integers .
Definition
gate_separator.hpp:29
bb::GateSeparatorPolynomial::betas
std::vector< FF > betas
The challenges .
Definition
gate_separator.hpp:22
bb::GateSeparatorPolynomial::partially_evaluate
void partially_evaluate(FF challenge)
Partially evaluate the -polynomial at the new challenge and update .
Definition
gate_separator.hpp:109
bb::GateSeparatorPolynomial::partial_evaluation_result
FF partial_evaluation_result
The value obtained by partially evaluating one variable in the power polynomial at each round....
Definition
gate_separator.hpp:48
bb::field< Bn254FrParams >
bb::field< Bn254FrParams >::random_element
static field random_element(numeric::RNG *engine=nullptr) noexcept
Definition
field_impl.hpp:665
src
barretenberg
polynomials
gate_separator.test.cpp
Generated by
1.9.8