Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
scalar_mul_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 scalar_mulImpl<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 ecc_INFINITY_X = FF(0);
19 const auto ecc_INFINITY_Y = FF(0);
20 const auto scalar_mul_LATCH_CONDITION = in.get(C::scalar_mul_end) + in.get(C::precomputed_first_row);
21 const auto scalar_mul_SHOULD_PASS = in.get(C::scalar_mul_sel_not_end) * (FF(1) - in.get(C::scalar_mul_bit));
22
23 {
24 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
25 auto tmp =
26 static_cast<View>(in.get(C::scalar_mul_sel)) * (FF(1) - static_cast<View>(in.get(C::scalar_mul_sel)));
27 std::get<0>(evals) += (tmp * scaling_factor);
28 }
29 {
30 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
31 auto tmp = static_cast<View>(in.get(C::scalar_mul_point_inf)) *
32 (FF(1) - static_cast<View>(in.get(C::scalar_mul_point_inf)));
33 std::get<1>(evals) += (tmp * scaling_factor);
34 }
35 {
36 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
37 auto tmp =
38 static_cast<View>(in.get(C::scalar_mul_start)) * (FF(1) - static_cast<View>(in.get(C::scalar_mul_start)));
39 std::get<2>(evals) += (tmp * scaling_factor);
40 }
41 {
42 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
43 auto tmp =
44 static_cast<View>(in.get(C::scalar_mul_end)) * (FF(1) - static_cast<View>(in.get(C::scalar_mul_end)));
45 std::get<3>(evals) += (tmp * scaling_factor);
46 }
47 { // SEL_ON_START_OR_END
48 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
49 auto tmp = (static_cast<View>(in.get(C::scalar_mul_start)) + static_cast<View>(in.get(C::scalar_mul_end))) *
50 (FF(1) - static_cast<View>(in.get(C::scalar_mul_sel)));
51 std::get<4>(evals) += (tmp * scaling_factor);
52 }
53 { // TRACE_CONTINUITY
54 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
55 auto tmp = (FF(1) - CView(scalar_mul_LATCH_CONDITION)) *
56 (static_cast<View>(in.get(C::scalar_mul_sel)) - static_cast<View>(in.get(C::scalar_mul_sel_shift)));
57 std::get<5>(evals) += (tmp * scaling_factor);
58 }
59 { // START_AFTER_LATCH
60 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
61 auto tmp = static_cast<View>(in.get(C::scalar_mul_sel_shift)) *
62 (static_cast<View>(in.get(C::scalar_mul_start_shift)) - CView(scalar_mul_LATCH_CONDITION));
63 std::get<6>(evals) += (tmp * scaling_factor);
64 }
65 {
66 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
67 auto tmp = (static_cast<View>(in.get(C::scalar_mul_sel_not_end)) -
68 (static_cast<View>(in.get(C::scalar_mul_sel)) - static_cast<View>(in.get(C::scalar_mul_end))));
69 std::get<7>(evals) += (tmp * scaling_factor);
70 }
71 { // INPUT_CONSISTENCY_X
72 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
73 auto tmp =
74 static_cast<View>(in.get(C::scalar_mul_sel_not_end)) *
75 (static_cast<View>(in.get(C::scalar_mul_point_x)) - static_cast<View>(in.get(C::scalar_mul_point_x_shift)));
76 std::get<8>(evals) += (tmp * scaling_factor);
77 }
78 { // INPUT_CONSISTENCY_Y
79 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
80 auto tmp =
81 static_cast<View>(in.get(C::scalar_mul_sel_not_end)) *
82 (static_cast<View>(in.get(C::scalar_mul_point_y)) - static_cast<View>(in.get(C::scalar_mul_point_y_shift)));
83 std::get<9>(evals) += (tmp * scaling_factor);
84 }
85 { // INPUT_CONSISTENCY_INF
86 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
87 auto tmp = static_cast<View>(in.get(C::scalar_mul_sel_not_end)) *
88 (static_cast<View>(in.get(C::scalar_mul_point_inf)) -
89 static_cast<View>(in.get(C::scalar_mul_point_inf_shift)));
90 std::get<10>(evals) += (tmp * scaling_factor);
91 }
92 { // INPUT_CONSISTENCY_SCALAR
93 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
94 auto tmp =
95 static_cast<View>(in.get(C::scalar_mul_sel_not_end)) *
96 (static_cast<View>(in.get(C::scalar_mul_scalar)) - static_cast<View>(in.get(C::scalar_mul_scalar_shift)));
97 std::get<11>(evals) += (tmp * scaling_factor);
98 }
99 {
100 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
101 auto tmp = static_cast<View>(in.get(C::scalar_mul_start)) *
102 (static_cast<View>(in.get(C::scalar_mul_bit_idx)) - FF(253));
103 std::get<12>(evals) += (tmp * scaling_factor);
104 }
105 {
106 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
107 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) * static_cast<View>(in.get(C::scalar_mul_bit_idx));
108 std::get<13>(evals) += (tmp * scaling_factor);
109 }
110 { // DECREMENT_INDEX
111 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
112 auto tmp = static_cast<View>(in.get(C::scalar_mul_sel_not_end)) *
113 (static_cast<View>(in.get(C::scalar_mul_bit_idx)) -
114 (static_cast<View>(in.get(C::scalar_mul_bit_idx_shift)) + FF(1)));
115 std::get<14>(evals) += (tmp * scaling_factor);
116 }
117 {
118 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
119 auto tmp =
120 static_cast<View>(in.get(C::scalar_mul_sel)) * (static_cast<View>(in.get(C::scalar_mul_const_two)) - FF(2));
121 std::get<15>(evals) += (tmp * scaling_factor);
122 }
123 {
124 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
125 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) *
126 (static_cast<View>(in.get(C::scalar_mul_temp_x)) - static_cast<View>(in.get(C::scalar_mul_point_x)));
127 std::get<16>(evals) += (tmp * scaling_factor);
128 }
129 {
130 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
131 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) *
132 (static_cast<View>(in.get(C::scalar_mul_temp_y)) - static_cast<View>(in.get(C::scalar_mul_point_y)));
133 std::get<17>(evals) += (tmp * scaling_factor);
134 }
135 {
136 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
137 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) * (static_cast<View>(in.get(C::scalar_mul_temp_inf)) -
138 static_cast<View>(in.get(C::scalar_mul_point_inf)));
139 std::get<18>(evals) += (tmp * scaling_factor);
140 }
141 {
142 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
143 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) *
144 ((static_cast<View>(in.get(C::scalar_mul_point_x)) * static_cast<View>(in.get(C::scalar_mul_bit)) +
145 CView(ecc_INFINITY_X) * (FF(1) - static_cast<View>(in.get(C::scalar_mul_bit)))) -
146 static_cast<View>(in.get(C::scalar_mul_res_x)));
147 std::get<19>(evals) += (tmp * scaling_factor);
148 }
149 {
150 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
151 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) *
152 ((static_cast<View>(in.get(C::scalar_mul_point_y)) * static_cast<View>(in.get(C::scalar_mul_bit)) +
153 CView(ecc_INFINITY_Y) * (FF(1) - static_cast<View>(in.get(C::scalar_mul_bit)))) -
154 static_cast<View>(in.get(C::scalar_mul_res_y)));
155 std::get<20>(evals) += (tmp * scaling_factor);
156 }
157 {
158 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
159 auto tmp = static_cast<View>(in.get(C::scalar_mul_end)) *
160 (((static_cast<View>(in.get(C::scalar_mul_point_inf)) - FF(1)) *
161 static_cast<View>(in.get(C::scalar_mul_bit)) +
162 FF(1)) -
163 static_cast<View>(in.get(C::scalar_mul_res_inf)));
164 std::get<21>(evals) += (tmp * scaling_factor);
165 }
166 {
167 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
168 auto tmp =
169 (static_cast<View>(in.get(C::scalar_mul_should_add)) -
170 static_cast<View>(in.get(C::scalar_mul_sel_not_end)) * static_cast<View>(in.get(C::scalar_mul_bit)));
171 std::get<22>(evals) += (tmp * scaling_factor);
172 }
173 {
174 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
175 auto tmp = CView(scalar_mul_SHOULD_PASS) * (static_cast<View>(in.get(C::scalar_mul_res_x)) -
176 static_cast<View>(in.get(C::scalar_mul_res_x_shift)));
177 std::get<23>(evals) += (tmp * scaling_factor);
178 }
179 {
180 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
181 auto tmp = CView(scalar_mul_SHOULD_PASS) * (static_cast<View>(in.get(C::scalar_mul_res_y)) -
182 static_cast<View>(in.get(C::scalar_mul_res_y_shift)));
183 std::get<24>(evals) += (tmp * scaling_factor);
184 }
185 {
186 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
187 auto tmp = CView(scalar_mul_SHOULD_PASS) * (static_cast<View>(in.get(C::scalar_mul_res_inf)) -
188 static_cast<View>(in.get(C::scalar_mul_res_inf_shift)));
189 std::get<25>(evals) += (tmp * scaling_factor);
190 }
191}
192
193} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
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.