Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
ecc_point_table_relation_impl.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
9
13
14namespace bb {
15
28template <typename FF>
29template <typename ContainerOverSubrelations, typename AllEntities, typename Parameters>
30void ECCVMPointTableRelationImpl<FF>::accumulate(ContainerOverSubrelations& accumulator,
31 const AllEntities& in,
32 const Parameters& /*unused*/,
33 const FF& scaling_factor)
34{
35 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
36 using View = typename Accumulator::View;
37
38 const auto& Tx = View(in.precompute_tx);
39 const auto& Tx_shift = View(in.precompute_tx_shift);
40 const auto& Ty = View(in.precompute_ty);
41 const auto& Ty_shift = View(in.precompute_ty_shift);
42 const auto& Dx = View(in.precompute_dx);
43 const auto& Dx_shift = View(in.precompute_dx_shift);
44 const auto& Dy = View(in.precompute_dy);
45 const auto& Dy_shift = View(in.precompute_dy_shift);
46 const auto& precompute_point_transition = View(in.precompute_point_transition);
47 const auto& lagrange_first = View(in.lagrange_first);
48
134 auto two_x = Tx + Tx;
135 auto three_x = two_x + Tx;
136 auto three_xx = Tx * three_x;
137 auto nine_xxxx = three_xx.sqr();
138 auto two_y = Ty + Ty;
139 auto four_yy = two_y.sqr();
140 auto x_double_check = (Dx + two_x) * four_yy - nine_xxxx;
141 auto y_double_check = (Ty + Dy) * two_y + three_xx * (Dx - Tx);
142 std::get<0>(accumulator) += precompute_point_transition * x_double_check * scaling_factor;
143 std::get<1>(accumulator) += precompute_point_transition * y_double_check * scaling_factor;
144
150 std::get<2>(accumulator) +=
151 (-lagrange_first + 1) * (-precompute_point_transition + 1) * (Dx - Dx_shift) * scaling_factor;
152 std::get<3>(accumulator) +=
153 (-lagrange_first + 1) * (-precompute_point_transition + 1) * (Dy - Dy_shift) * scaling_factor;
154
173 const auto& x1 = Tx_shift;
174 const auto& y1 = Ty_shift;
175 const auto& x2 = Dx;
176 const auto& y2 = Dy;
177 const auto& x3 = Tx;
178 const auto& y3 = Ty;
179 const auto lambda_numerator = y2 - y1;
180 const auto lambda_denominator = x2 - x1;
181 auto x_add_check = (x3 + x2 + x1) * lambda_denominator.sqr() - lambda_numerator.sqr();
182 auto y_add_check = (y3 + y1) * lambda_denominator + (x3 - x1) * lambda_numerator;
183 std::get<4>(accumulator) +=
184 (-lagrange_first + 1) * (-precompute_point_transition + 1) * x_add_check * scaling_factor;
185 std::get<5>(accumulator) +=
186 (-lagrange_first + 1) * (-precompute_point_transition + 1) * y_add_check * scaling_factor;
187}
188
189} // namespace bb
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters &, const FF &scaling_factor)
ECCVMPointTableRelationImpl.
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13