Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
translator_permutation_relation_impl.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
7#pragma once
9
10namespace bb {
11
41template <typename FF>
42template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
43void TranslatorPermutationRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulators,
44 const AllEntities& in,
45 const Parameters& params,
46 const FF& scaling_factor)
47{
48 [&]() {
50 using View = typename Accumulator::View;
51
52 const auto z_perm = View(in.z_perm);
53 const auto z_perm_shift = View(in.z_perm_shift);
54 const auto lagrange_first = View(in.lagrange_first);
55 const auto lagrange_last = View(in.lagrange_last);
56
57 // Contribution (1)
58 std::get<0>(accumulators) +=
59 (((z_perm + lagrange_first) * compute_grand_product_numerator<Accumulator>(in, params)) -
60 ((z_perm_shift + lagrange_last) * compute_grand_product_denominator<Accumulator>(in, params))) *
61 scaling_factor;
62 }();
63
64 [&]() {
66 using View = typename Accumulator::View;
67
68 const auto z_perm_shift = View(in.z_perm_shift);
69 const auto lagrange_last = View(in.lagrange_last);
70
71 // Contribution (2)
72 std::get<1>(accumulators) += (lagrange_last * z_perm_shift) * scaling_factor;
73 }();
74
75 [&]() {
77 using View = typename Accumulator::View;
78
79 const auto z_perm = View(in.z_perm);
80 const auto lagrange_first = View(in.lagrange_first);
81
82 // Contribution (3): Enforce z_perm starts at 0. The grand product initialization relies on
83 // z_perm[0] = 0 so that (z_perm + lagrange_first) evaluates to 1 at the first row.
84 std::get<2>(accumulators) += (lagrange_first * z_perm) * scaling_factor;
85 }();
86};
87} // namespace bb
static void accumulate(ContainerOverSubrelations &accumulators, const AllEntities &in, const Parameters &params, const FF &scaling_factor)
Compute contribution of the goblin translator permutation relation for a given edge (internal functio...
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13