Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
batch_mul_native.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
13#include <vector>
14
15namespace bb {
16
21template <typename Curve>
22static typename Curve::AffineElement batch_mul_native(std::span<const typename Curve::AffineElement> _points,
24{
25 using FF = typename Curve::ScalarField;
26 // Copy scalars since MSM mutates them (converts from Montgomery form)
27 std::vector<FF> scalars(_scalars.begin(), _scalars.end());
28 PolynomialSpan<const FF> scalar_span(0, scalars);
29 return scalar_multiplication::MSM<Curve>::msm(_points, scalar_span, /*handle_edge_cases=*/true);
30}
31
35template <typename Curve>
36static typename Curve::AffineElement batch_mul_native(const std::vector<typename Curve::AffineElement>& _points,
38{
39 return batch_mul_native<Curve>(std::span<const typename Curve::AffineElement>(_points),
41}
42
46template <typename Curve>
47static typename Curve::AffineElement batch_mul_native(std::span<const typename Curve::AffineElement> _points,
49{
50 return batch_mul_native<Curve>(_points, std::span<const typename Curve::ScalarField>(_scalars));
51}
52
53} // namespace bb
typename Group::affine_element AffineElement
Definition bn254.hpp:22
static AffineElement msm(std::span< const AffineElement > points, PolynomialSpan< const ScalarField > _scalars, bool handle_edge_cases=false) noexcept
Helper method to evaluate a single MSM. Internally calls batch_multi_scalar_mul
Entry point for Barretenberg command-line interface.
Definition api.hpp:5
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13