Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::stdlib::straus_scalar_slices< Builder > Class Template Reference

straus_scalar_slices decomposes an input scalar into bit-slices of size table_bits. Used in batch_mul, which implements the Straus multiscalar multiplication algorithm. More...

#include <straus_scalar_slice.hpp>

Public Types

using field_t = stdlib::field_t< Builder >
 

Public Member Functions

 straus_scalar_slices (Builder *context, const cycle_scalar< Builder > &scalars, size_t table_bits)
 Construct straus_scalar_slices from an input cycle_scalar and specified table_bits.
 
field_t operator[] (size_t index)
 Return a bit-slice associated with round index.
 

Public Attributes

size_t _table_bits
 
std::vector< field_tslices
 
std::vector< uint64_t > slices_native
 

Static Private Member Functions

static std::pair< std::vector< field_t >, std::vector< uint64_t > > compute_scalar_slices (Builder *context, const field_t &scalar, size_t num_bits, size_t table_bits)
 Convert an input cycle_scalar field element into a vector of bit-slices.
 

Detailed Description

template<typename Builder>
class bb::stdlib::straus_scalar_slices< Builder >

straus_scalar_slices decomposes an input scalar into bit-slices of size table_bits. Used in batch_mul, which implements the Straus multiscalar multiplication algorithm.

Definition at line 24 of file straus_scalar_slice.hpp.

Member Typedef Documentation

◆ field_t

Definition at line 26 of file straus_scalar_slice.hpp.

Constructor & Destructor Documentation

◆ straus_scalar_slices()

template<typename Builder >
bb::stdlib::straus_scalar_slices< Builder >::straus_scalar_slices ( Builder context,
const cycle_scalar< Builder > &  scalar,
size_t  table_bits 
)

Construct straus_scalar_slices from an input cycle_scalar and specified table_bits.

Performs an in-circuit decomposition of the input cycle_scalar into bit-slices of size table_bits.

Template Parameters
Builder
Parameters
context
scalar
table_bits

Definition at line 82 of file straus_scalar_slice.cpp.

Member Function Documentation

◆ compute_scalar_slices()

template<typename Builder >
std::pair< std::vector< field_t< Builder > >, std::vector< uint64_t > > bb::stdlib::straus_scalar_slices< Builder >::compute_scalar_slices ( Builder context,
const field_t scalar,
size_t  num_bits,
size_t  table_bits 
)
staticprivate

Convert an input cycle_scalar field element into a vector of bit-slices.

Each slice contains table_bits bits. Also performs an implicit range check on the input slices via decompose_into_default_range

Template Parameters
Builder
Parameters
contextThe circuit builder
scalarThe field element to decompose
num_bitsNumber of bits in the scalar
table_bitsNumber of bits per slice
Returns
pair of stdlib slices and native slices

Definition at line 28 of file straus_scalar_slice.cpp.

◆ operator[]()

template<typename Builder >
field_t< Builder > bb::stdlib::straus_scalar_slices< Builder >::operator[] ( size_t  index)

Return a bit-slice associated with round index.

In Straus algorithm, index is a known parameter, so no need for expensive lookup tables

Template Parameters
Builder
Parameters
index
Returns
field_t<Builder>

Definition at line 114 of file straus_scalar_slice.cpp.

Member Data Documentation

◆ _table_bits

template<typename Builder >
size_t bb::stdlib::straus_scalar_slices< Builder >::_table_bits

Definition at line 30 of file straus_scalar_slice.hpp.

◆ slices

template<typename Builder >
std::vector<field_t> bb::stdlib::straus_scalar_slices< Builder >::slices

Definition at line 31 of file straus_scalar_slice.hpp.

◆ slices_native

template<typename Builder >
std::vector<uint64_t> bb::stdlib::straus_scalar_slices< Builder >::slices_native

Definition at line 32 of file straus_scalar_slice.hpp.


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