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 =
29 static_cast<View>(in.get(C::gt_sel_addressing)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_addressing)));
30 std::get<1>(evals) += (tmp * scaling_factor);
31 }
32 {
33 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
34 auto tmp = static_cast<View>(in.get(C::gt_sel_alu)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_alu)));
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_gas)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_gas)));
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_others)) * (FF(1) - static_cast<View>(in.get(C::gt_sel_others)));
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_addressing)) + static_cast<View>(in.get(C::gt_sel_alu)) +
50 static_cast<View>(in.get(C::gt_sel_gas)) + static_cast<View>(in.get(C::gt_sel_others))) *
51 (FF(1) - static_cast<View>(in.get(C::gt_sel)));
52 std::get<5>(evals) += (tmp * scaling_factor);
53 }
54 {
55 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
56 auto tmp = static_cast<View>(in.get(C::gt_res)) * (FF(1) - static_cast<View>(in.get(C::gt_res)));
57 std::get<6>(evals) += (tmp * scaling_factor);
58 }
59 { // GT_RESULT
60 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
61 auto tmp =
62 static_cast<View>(in.get(C::gt_sel)) *
63 (((CView(gt_A_GT_B) - CView(gt_A_LTE_B)) * static_cast<View>(in.get(C::gt_res)) + CView(gt_A_LTE_B)) -
64 static_cast<View>(in.get(C::gt_abs_diff)));
65 std::get<7>(evals) += (tmp * scaling_factor);
66 }
67}
68
69} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
Definition gt_impl.hpp:11
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:35
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.