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: Complete, auditors: [Sergei], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6#pragma once
9
10namespace bb {
11
36template <typename FF_> class MultilinearBatchingAccumulatorRelationImpl {
37 public:
38 using FF = FF_;
39
40 static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
41 3, // non-shifted accumulator contribution
42 3, // shifted accumulator contribution
43 };
44
45 static constexpr std::array<bool, 2> SUBRELATION_LINEARLY_INDEPENDENT = { false, false };
46
50 template <typename AllEntities> inline static bool skip(const AllEntities& in)
51 {
52 return (in.batched_unshifted_accumulator.is_zero() && in.batched_shifted_accumulator.is_zero()) ||
53 (in.eq_accumulator.is_zero());
54 }
55
60 template <typename ContainerOverSubrelations, typename AllEntities>
61 inline static void accumulate(ContainerOverSubrelations& evals,
62 const AllEntities& in,
63 [[maybe_unused]] const RelationParameters<FF>& relation_parameters = {},
64 [[maybe_unused]] const FF& scaling_factor = {})
65 {
67
68 auto batched_unshifted_acc = Accumulator(in.batched_unshifted_accumulator);
69 auto eq_acc = Accumulator(in.eq_accumulator);
70 auto batched_shifted_acc = Accumulator(in.batched_shifted_accumulator);
71
72 std::get<0>(evals) += (batched_unshifted_acc * eq_acc);
73 std::get<1>(evals) += (batched_shifted_acc * eq_acc);
74 };
75};
87template <typename FF_> class MultilinearBatchingInstanceRelationImpl {
88 public:
89 using FF = FF_;
90
91 static constexpr std::array<size_t, 2> SUBRELATION_PARTIAL_LENGTHS{
92 3, // non-shifted instance contribution
93 3, // shifted instance contribution
94 };
95
96 static constexpr std::array<bool, 2> SUBRELATION_LINEARLY_INDEPENDENT = { false, false };
97
101 template <typename AllEntities> static bool skip(const AllEntities& in)
102 {
103 return (in.batched_unshifted_accumulator.is_zero() && in.batched_unshifted_instance.is_zero() &&
104 in.batched_shifted_accumulator.is_zero() && in.batched_shifted_instance.is_zero()) ||
105 (in.eq_accumulator.is_zero() && in.eq_instance.is_zero());
106 }
107
112 template <typename ContainerOverSubrelations, typename AllEntities>
113 static void accumulate(ContainerOverSubrelations& evals,
114 const AllEntities& in,
115 [[maybe_unused]] const RelationParameters<FF>& relation_parameters = {},
116 [[maybe_unused]] const FF& scaling_factor = {})
117 {
119
120 auto batched_unshifted_inst = Accumulator(in.batched_unshifted_instance);
121 auto eq_inst = Accumulator(in.eq_instance);
122 auto batched_shifted_inst = Accumulator(in.batched_shifted_instance);
123
124 std::get<0>(evals) += (batched_unshifted_inst * eq_inst);
125 std::get<1>(evals) += (batched_shifted_inst * eq_inst);
126 };
127};
128
129template <typename FF>
131template <typename FF>
133} // namespace bb
Multilinear batching relations for HyperNova claim batching.
static bool skip(const AllEntities &in)
Returns true if the contribution from all subrelations for the provided inputs is identically zero.
static constexpr std::array< bool, 2 > SUBRELATION_LINEARLY_INDEPENDENT
static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &relation_parameters={}, const FF &scaling_factor={})
Accumulate the accumulator's contribution to the batching sumcheck.
Relation for instance contribution to the multilinear batching sumcheck.
static constexpr std::array< bool, 2 > SUBRELATION_LINEARLY_INDEPENDENT
static bool skip(const AllEntities &in)
Returns true if the contribution from all subrelations for the provided inputs is identically zero.
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &relation_parameters={}, const FF &scaling_factor={})
Accumulate the instance's contribution to the batching sumcheck.
static constexpr std::array< size_t, 2 > SUBRELATION_PARTIAL_LENGTHS
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.