Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
prover_polynomials.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Planned, auditors: [], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6#pragma once
7
10
11namespace bb {
12
24template <typename AllEntitiesBase, typename AllValuesType, typename Polynomial>
25class ProverPolynomialsBase : public AllEntitiesBase {
26 public:
27 // Define all operations as default, except copy construction/assignment
34 [[nodiscard]] size_t get_polynomial_size() const { return this->q_c.virtual_size(); }
35 [[nodiscard]] AllValuesType get_row(size_t row_idx) const
36 {
37 AllValuesType result;
38 for (auto [result_field, polynomial] : zip_view(result.get_all(), this->get_all())) {
39 result_field = polynomial[row_idx];
40 }
41 return result;
42 }
43
44 [[nodiscard]] AllValuesType get_row_for_permutation_arg(size_t row_idx)
45 {
46 AllValuesType result;
47 for (auto [result_field, polynomial] : zip_view(result.get_sigmas(), this->get_sigmas())) {
48 result_field = polynomial[row_idx];
49 }
50 for (auto [result_field, polynomial] : zip_view(result.get_ids(), this->get_ids())) {
51 result_field = polynomial[row_idx];
52 }
53 for (auto [result_field, polynomial] : zip_view(result.get_wires(), this->get_wires())) {
54 result_field = polynomial[row_idx];
55 }
56 return result;
57 }
58
59 // Set all shifted polynomials based on their to-be-shifted counterpart
61 {
62 for (auto [shifted, to_be_shifted] : zip_view(this->get_shifted(), this->get_to_be_shifted())) {
63 shifted = to_be_shifted.shifted();
64 }
65 }
66
67 // Returns the maximum end_index across all polynomials (i.e. the actual data extent)
68 [[nodiscard]] size_t max_end_index() const
69 {
70 size_t result = 0;
71 for (const auto& poly : this->get_all()) {
72 result = std::max(result, poly.end_index());
73 }
74 return result;
75 }
76
77 void increase_polynomials_virtual_size(const size_t size_in)
78 {
79 for (auto& polynomial : this->get_all()) {
80 polynomial.increase_virtual_size(size_in);
81 }
82 }
83};
84
85} // namespace bb
A container for polynomials handles used by the prover.
ProverPolynomialsBase & operator=(const ProverPolynomialsBase &)=delete
ProverPolynomialsBase(const ProverPolynomialsBase &o)=delete
AllValuesType get_row(size_t row_idx) const
void increase_polynomials_virtual_size(const size_t size_in)
AllValuesType get_row_for_permutation_arg(size_t row_idx)
ProverPolynomialsBase & operator=(ProverPolynomialsBase &&o) noexcept=default
ProverPolynomialsBase(ProverPolynomialsBase &&o) noexcept=default
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13