Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
multilinear_batching_relation.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, 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
25template <typename FF_, size_t NumClaims> class MultilinearBatchingRelationImpl {
26 public:
27 using FF = FF_;
28
29 static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
30 3, // non-shifted accumulator contribution
31 3, // shifted accumulator contribution
32 };
33
34 static constexpr std::array<bool, 2> SUBRELATION_LINEARLY_INDEPENDENT = { false, false };
35
36 template <typename AllEntities> static bool skip(const AllEntities& in)
37 {
38 for (size_t idx = 0; idx < NumClaims; ++idx) {
39 const bool should_skip =
40 (in.non_shifted(idx).is_zero() && in.shifted(idx).is_zero()) || in.eq(idx).is_zero();
41 if (!should_skip) {
42 return false;
43 }
44 }
45 return true;
46 }
47
48 template <typename ContainerOverSubrelations, typename AllEntities>
49 static void accumulate(ContainerOverSubrelations& evals,
50 const AllEntities& in,
51 const RelationParameters<FF>& relation_parameters = {},
52 [[maybe_unused]] const FF& scaling_factor = {})
53 {
54 static_assert(NumClaims <= RelationParameters<FF>::NUM_MULTILINEAR_BATCHING_CHALLENGES);
56
57 // The powers of the batching challenge γ are precomputed by the caller; the i-th polynomial is weighted by
58 // γ^i = multilinear_batching_challenges[i].
59 const auto& gamma_powers = relation_parameters.multilinear_batching_challenges;
60 for (size_t idx = 0; idx < NumClaims; ++idx) {
61 const auto eq = Accumulator(in.eq(idx)) * gamma_powers[idx];
62 std::get<0>(evals) += Accumulator(in.non_shifted(idx)) * eq;
63 std::get<1>(evals) += Accumulator(in.shifted(idx)) * eq;
64 }
65 };
66};
67
68template <typename FF, size_t NumClaims>
70
71} // namespace bb
Relation for the multilinear batching sumcheck.
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &relation_parameters={}, const FF &scaling_factor={})
static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
static constexpr std::array< bool, 2 > SUBRELATION_LINEARLY_INDEPENDENT
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Container for parameters used by the grand product (permutation, lookup) Honk relations.