Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::scalar_multiplication::MSM_fast< Curve > Class Template Reference

#include <scalar_multiplication_fast.hpp>

Public Types

using Element = typename Curve::Element
 
using ScalarField = typename Curve::ScalarField
 
using AffineElement = typename Curve::AffineElement
 

Static Public Member Functions

static AffineElement msm (std::span< const AffineElement > points, PolynomialSpan< const ScalarField > scalars, bool handle_edge_cases=false, bool dedup_hint=false) noexcept
 Single MSM_fast convenience wrapper — returns the result as an AffineElement.
 
static std::vector< AffineElementbatch_multi_scalar_mul (std::span< const AffineElement > points, std::span< PolynomialSpan< ScalarField > > scalars, bool handle_edge_cases=true, std::span< const uint8_t > dedup_hints={}) noexcept
 Batch driver for multiple MSMs. Returns one AffineElement per input MSM_fast.
 

Detailed Description

template<typename Curve>
class bb::scalar_multiplication::MSM_fast< Curve >

Definition at line 128 of file scalar_multiplication_fast.hpp.

Member Typedef Documentation

◆ AffineElement

template<typename Curve >
using bb::scalar_multiplication::MSM_fast< Curve >::AffineElement = typename Curve::AffineElement

Definition at line 132 of file scalar_multiplication_fast.hpp.

◆ Element

Definition at line 130 of file scalar_multiplication_fast.hpp.

◆ ScalarField

template<typename Curve >
using bb::scalar_multiplication::MSM_fast< Curve >::ScalarField = typename Curve::ScalarField

Definition at line 131 of file scalar_multiplication_fast.hpp.

Member Function Documentation

◆ batch_multi_scalar_mul()

template<typename Curve >
std::vector< typename Curve::AffineElement > MSM_fast::batch_multi_scalar_mul ( std::span< const AffineElement points,
std::span< PolynomialSpan< ScalarField > >  scalars,
bool  handle_edge_cases = true,
std::span< const uint8_t >  dedup_hints = {} 
)
staticnoexcept

Batch driver for multiple MSMs. Returns one AffineElement per input MSM_fast.

Every MSM_fast in the batch shares a single contiguous point set (the SRS / GLV table); each MSM_fast picks its own range via scalars[m].start_index and scalars[m].size(). MSM_fast m computes Σ_i scalars[m][i] * points[scalars[m].start_index + i].

Independent MSMs run sequentially (each MSM_fast is itself round-parallel internally). This matches the legacy interface but the parallelisation strategy is different: the legacy implementation work-balanced points across threads spanning multiple MSMs; round-parallel parallelises within each MSM_fast, so one MSM_fast at a time uses the full thread pool. For the typical chonk workload (commit batches of polys of size 2^20), this is faster because per-MSM_fast threading dominates over inter-MSM_fast stealing.

Parameters
pointsShared point set (SRS prefix). Every MSM_fast indexes into this span.
scalarsPer-MSM_fast scalars carrying the start offset into points.
dedup_hintsOptional per-MSM_fast dedup opt-ins (parallel to scalars): a non-zero entry opts that MSM_fast's input scalars into the duplicate-cluster pre-pass. Empty span means no dedup anywhere.

Definition at line 231 of file pippenger_batched.hpp.

◆ msm()

template<typename Curve >
Curve::AffineElement bb::scalar_multiplication::MSM_fast< Curve >::msm ( std::span< const AffineElement points,
PolynomialSpan< const ScalarField scalars,
bool  handle_edge_cases = false,
bool  dedup_hint = false 
)
staticnoexcept

Single MSM_fast convenience wrapper — returns the result as an AffineElement.

Parameters
handle_edge_casesfalse (default): fast affine round-parallel path. true: Jacobian fast path (handles edge cases).
dedup_hintWhen true, opts this MSM_fast into the input-scalar dedup pre-pass.

Definition at line 2908 of file scalar_multiplication_fast.cpp.


The documentation for this class was generated from the following files: