Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
gt_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void gtImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto gt_A_LTE_B = (in.get(C::gt_input_b) - in.get(C::gt_input_a));
19 const auto gt_A_GT_B = ((in.get(C::gt_input_a) - in.get(C::gt_input_b)) - FF(1));
20
21 {
22 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
23 auto tmp = static_cast<View>(in.get(C::gt_sel)) * (FF(1) - static_cast<View>(in.get(C::gt_sel)));
24 std::get<0>(evals) += (tmp * scaling_factor);
25 }
26 {
27 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
28 auto tmp = static_cast<View>(in.get(C::gt_sel_sha256)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_sha256)));
29 std::get<1>(evals) += (tmp * scaling_factor);
30 }
31 {
32 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
33 auto tmp =
34 static_cast<View>(in.get(C::gt_sel_addressing)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_addressing)));
35 std::get<2>(evals) += (tmp * scaling_factor);
36 }
37 {
38 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
39 auto tmp = static_cast<View>(in.get(C::gt_sel_alu)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_alu)));
40 std::get<3>(evals) += (tmp * scaling_factor);
41 }
42 {
43 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
44 auto tmp = static_cast<View>(in.get(C::gt_sel_gas)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_gas)));
45 std::get<4>(evals) += (tmp * scaling_factor);
46 }
47 {
48 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
49 auto tmp = static_cast<View>(in.get(C::gt_sel_others)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_others)));
50 std::get<5>(evals) += (tmp * scaling_factor);
51 }
52 {
53 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
54 auto tmp = (static_cast<View>(in.get(C::gt_sel_sha256)) + static_cast<View>(in.get(C::gt_sel_addressing)) +
55 static_cast<View>(in.get(C::gt_sel_alu)) + static_cast<View>(in.get(C::gt_sel_gas)) +
56 static_cast<View>(in.get(C::gt_sel_others))) *
57 (FF(1) - static_cast<View>(in.get(C::gt_sel)));
58 std::get<6>(evals) += (tmp * scaling_factor);
59 }
60 {
61 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
62 auto tmp = static_cast<View>(in.get(C::gt_res)) * (FF(1) - static_cast<View>(in.get(C::gt_res)));
63 std::get<7>(evals) += (tmp * scaling_factor);
64 }
65 { // GT_RESULT
66 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
67 auto tmp =
68 static_cast<View>(in.get(C::gt_sel)) *
69 (((CView(gt_A_GT_B) - CView(gt_A_LTE_B)) * static_cast<View>(in.get(C::gt_res)) + CView(gt_A_LTE_B)) -
70 static_cast<View>(in.get(C::gt_abs_diff)));
71 std::get<8>(evals) += (tmp * scaling_factor);
72 }
73}
74
75} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
Definition gt_impl.hpp:11
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.