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: Planned, auditors: [Sergei], commit: }
3
// external_1: { status: not started, auditors: [], commit: }
4
// external_2: { status: not started, auditors: [], commit: }
5
// =====================
6
7
#pragma once
8
#include "
barretenberg/common/ref_span.hpp
"
9
#include "
barretenberg/ecc/curves/bn254/bn254.hpp
"
10
#include "
barretenberg/ecc/curves/grumpkin/grumpkin.hpp
"
11
#include "
barretenberg/ecc/scalar_multiplication/scalar_multiplication.hpp
"
12
#include "
barretenberg/stdlib/primitives/biggroup/biggroup.hpp
"
13
#include <vector>
14
15
namespace
bb
{
16
21
template
<
typename
Curve>
22
static
typename
Curve::AffineElement
batch_mul_native(
std::span<const typename Curve::AffineElement>
_points,
23
std::span<const typename Curve::ScalarField>
_scalars)
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
35
template
<
typename
Curve>
36
static
typename
Curve::AffineElement
batch_mul_native(
const
std::vector<typename Curve::AffineElement>
& _points,
37
const
std::vector<typename Curve::ScalarField>
& _scalars)
38
{
39
return
batch_mul_native<Curve>(
std::span<const typename Curve::AffineElement>
(_points),
40
std::span<const typename Curve::ScalarField>
(_scalars));
41
}
42
46
template
<
typename
Curve>
47
static
typename
Curve::AffineElement
batch_mul_native(
std::span<const typename Curve::AffineElement>
_points,
48
const
std::vector<typename Curve::ScalarField>
& _scalars)
49
{
50
return
batch_mul_native<Curve>(_points,
std::span<const typename Curve::ScalarField>
(_scalars));
51
}
52
53
}
// namespace bb
biggroup.hpp
bb::curve::BN254::AffineElement
typename Group::affine_element AffineElement
Definition
bn254.hpp:22
bb::curve::Grumpkin::ScalarField
bb::fq ScalarField
Definition
grumpkin.hpp:59
bb::scalar_multiplication::MSM::msm
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
Definition
scalar_multiplication.cpp:844
bn254.hpp
grumpkin.hpp
bb
Entry point for Barretenberg command-line interface.
Definition
api.hpp:5
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
ref_span.hpp
scalar_multiplication.hpp
bb::field< bb::Bn254FrParams >
src
barretenberg
commitment_schemes
utils
batch_mul_native.hpp
Generated by
1.9.8