Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
element_batch_mul.cpp
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
11
12namespace bb::group_elements {
13
14// Type trait to map element template parameters to the corresponding Curve type
15template <class Fq, class Fr, class Params> struct curve_for_element;
16
17template <> struct curve_for_element<fq, fr, Bn254G1Params> {
19};
20
21template <> struct curve_for_element<fr, fq, grumpkin::G1Params> {
23};
24
25template <class Fq, class Fr, class Params>
27 std::span<const affine_element<Fq, Fr, Params>> points,
28 std::span<const Fr> scalars,
29 [[maybe_unused]] size_t max_num_bits,
30 bool with_edgecases,
31 [[maybe_unused]] const Fr& masking_scalar) noexcept
32{
33 if (scalars.empty()) {
35 }
36
38
39 return scalar_multiplication::pippenger<Curve>(PolynomialSpan<const Fr>(0, scalars), points, with_edgecases);
40}
41
42// Explicit instantiations for supported curves
44 std::span<const affine_element<fq, fr, Bn254G1Params>> points,
45 std::span<const fr> scalars,
46 size_t max_num_bits,
47 bool with_edgecases,
48 const fr& masking_scalar) noexcept;
49
51 std::span<const affine_element<fr, fq, grumpkin::G1Params>> points,
52 std::span<const fq> scalars,
53 size_t max_num_bits,
54 bool with_edgecases,
55 const fq& masking_scalar) noexcept;
56
57} // namespace bb::group_elements
static affine_element batch_mul(std::span< const affine_element > points, std::span< const Fr > scalars, size_t max_num_bits=0, bool with_edgecases=true, const Fr &masking_scalar=Fr(1)) noexcept
Multi-scalar multiplication: compute sum_i(scalars[i] * points[i])
static constexpr affine_element infinity()
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13