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

#include <polynomial.hpp>

Classes

struct  ContiguousVectorWriteProxyT
 
struct  ScalarWriteProxy
 
struct  VectorWriteProxyT
 

Public Types

enum class  DontZeroMemory { FLAG }
 
using FF = Fr
 

Public Member Functions

 Polynomial (size_t size, size_t virtual_size, size_t start_index=0)
 Initialize a Polynomial to size 'size', zeroing memory.
 
 Polynomial (size_t size)
 
 Polynomial (size_t size, size_t virtual_size, size_t start_index, DontZeroMemory flag)
 Initialize a Polynomial to size 'size'. Important: This does NOT zero memory.
 
 Polynomial (size_t size, size_t virtual_size, DontZeroMemory flag)
 
 Polynomial (size_t size, DontZeroMemory flag)
 
 Polynomial (const Polynomial &other)
 
 Polynomial (const Polynomial &other, size_t target_size)
 
 Polynomial (Polynomial &&other) noexcept
 
 Polynomial (std::span< const Fr > coefficients, size_t virtual_size)
 
 Polynomial (std::span< const Fr > coefficients)
 
 Polynomial ()=default
 
 Polynomial (std::span< const Fr > interpolation_points, std::span< const Fr > evaluations, size_t virtual_size)
 Create the degree-(m-1) polynomial T(X) that interpolates the given evaluations. We have T(xⱼ) = yⱼ for j=1,...,m.
 
Polynomialoperator= (Polynomial &&other) noexcept
 
Polynomialoperator= (const Polynomial &other)
 
 ~Polynomial ()=default
 
Polynomial share () const
 
bool is_zero () const
 Check whether or not a polynomial is identically zero.
 
bool operator== (Polynomial const &rhs) const
 
const Frget (size_t i, size_t virtual_padding=0) const
 Retrieves the value at the specified index.
 
bool is_empty () const
 
Polynomial shifted () const
 Returns a Polynomial the left-shift of self.
 
Polynomial reverse () const
 Returns the polynomial equal to the reverse of self.
 
Fr evaluate_mle (std::span< const Fr > evaluation_points, bool shift=false) const
 evaluate multi-linear extension p(X_0,…,X_{n-1}) = \sum_i a_i*L_i(X_0,…,X_{n-1}) at u = (u_0,…,u_{n-1}) If the polynomial is embedded into a lower dimension k<n, i.e, start_index + size <= 2^k, we evaluate it in a more efficient way. Note that a_j == 0 for any j >= 2^k. We fold over k dimensions and then multiply the result by (1 - u_k) * (1 - u_{k+1}) ... * (1 - u_{n-1}). In this case, for any i < 2^k, L_i is a multiple of (1 - X_k) * (1 - X_{k+1}) ... * (1 - X_{n-1}). Dividing p by this monomial leads to a multilinear extension over variables X_0, X_1, ..X_{k-1}.
 
void factor_roots (const Fr &root)
 Divides p(X) by (X-r) in-place. Assumes that p(rⱼ)=0 for all j.
 
Fr evaluate (const Fr &z) const
 
void add_scaled (PolynomialSpan< const Fr > other, const Fr &scaling_factor)
 adds the polynomial q(X) 'other', multiplied by a scaling factor.
 
void add_scaled_chunk (const ThreadChunk &chunk, PolynomialSpan< const Fr > other, const Fr &scaling_factor)
 
Polynomialoperator+= (PolynomialSpan< const Fr > other)
 adds the polynomial q(X) 'other'.
 
void add_chunk (const ThreadChunk &chunk, PolynomialSpan< const Fr > other)
 
Polynomialoperator-= (PolynomialSpan< const Fr > other)
 subtracts the polynomial q(X) 'other'.
 
void subtract_chunk (const ThreadChunk &chunk, PolynomialSpan< const Fr > other)
 
Polynomialoperator*= (const Fr &scaling_factor)
 sets this = p(X) to s⋅p(X)
 
void multiply_chunk (const ThreadChunk &chunk, const Fr &scaling_factor)
 
std::size_t size () const
 
std::size_t virtual_size () const
 
void increase_virtual_size (const size_t size_in)
 
Frdata ()
 
const Frdata () const
 
Frat (size_t index)
 Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[] as mutable and immutable, respectively. This means at() can only index within start_index()..end_index() unlike operator[] which can index 0..virtual_size.
 
const Frat (size_t index) const
 
const Froperator[] (size_t i)
 
const Froperator[] (size_t i) const
 
Fr operator[] (ScalarIndex ctx) const
 
template<size_t N, typename U = Fr>
VectorField< typename U::Params > operator[] (VectorIndex< N > ctx) const
 
template<size_t N, typename U = Fr>
VectorField< typename U::Params > operator[] (ContiguousVectorIndex< N > ctx) const
 
ScalarWriteProxy operator[] (ScalarIndex ctx)
 
template<size_t N, typename U = Fr>
VectorWriteProxyT< typename U::Params > operator[] (VectorIndex< N > ctx)
 
template<size_t N, typename U = Fr>
ContiguousVectorWriteProxyT< typename U::Params > operator[] (ContiguousVectorIndex< N > ctx)
 
void shrink_end_index (const size_t new_end_index)
 The end_index of the polynomial is decreased without any memory de-allocation. This is a very fast way to zeroize the polynomial tail from new_end_index to the end. It also means that the new end_index might be smaller than the backed memory.
 
Polynomial full () const
 Copys the polynomial, but with the whole address space usable. The value of the polynomial remains the same, but defined memory region differs.
 
size_t start_index () const
 
size_t end_index () const
 
bool is_shiftable () const
 
std::span< Frcoeffs (size_t offset=0)
 Strictly iterates the defined region of the polynomial. We keep this explicit, instead of having an implicit conversion to span. This is safer as it is more likely that we need to consider our start_index() along with the span, as in PolynomialSpan below.
 
std::span< const Frcoeffs (size_t offset=0) const
 
 operator PolynomialSpan< Fr > ()
 Convert to an std::span bundled with our start index.
 
 operator PolynomialSpan< const Fr > () const
 Convert to an std::span bundled with our start index.
 
auto indices () const
 
auto indexed_values ()
 
auto indexed_values () const
 
bool is_valid_set_index (size_t index) const
 Is this index valid for a set? i.e. calling poly.at(index) = value.
 
void set_if_valid_index (size_t index, const Fr &value)
 Like setting with at(), but allows zeroes to result in no set.
 
template<typename T >
void copy_vector (const std::vector< T > &vec)
 Copy over values from a vector that is of a convertible type.
 
void add_masking ()
 Write random ZK masking values at positions {1, 2, 3} (the disabled head region after the zero row).
 

Static Public Member Functions

static Polynomial shiftable (size_t virtual_size, bool masked=false)
 Utility to create a shiftable polynomial of given virtual size.
 
static Polynomial shiftable (size_t size, size_t virtual_size, bool masked=false)
 Utility to create a shiftable polynomial of given size and virtual size.
 
static Polynomial shiftable (size_t size, size_t virtual_size, DontZeroMemory flag)
 Overload of shiftable that leaves the backing memory uninitialized.
 
static Polynomial random (size_t size, size_t start_index=0)
 
static Polynomial random (size_t size, size_t virtual_size, size_t start_index)
 
static Polynomial create_non_parallel_zero_init (size_t size, size_t virtual_size)
 A factory to construct a polynomial where parallel initialization is not possible (e.g. AVM code).
 

Private Member Functions

void allocate_backing_memory (size_t size, size_t virtual_size, size_t start_index)
 

Private Attributes

SharedShiftedVirtualZeroesArray< Frcoefficients_
 

Detailed Description

template<typename Fr>
class bb::Polynomial< Fr >

Definition at line 181 of file polynomial.hpp.

Member Typedef Documentation

◆ FF

Definition at line 183 of file polynomial.hpp.

Member Enumeration Documentation

◆ DontZeroMemory

Enumerator
FLAG 

Definition at line 184 of file polynomial.hpp.

Constructor & Destructor Documentation

◆ Polynomial() [1/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( size_t  size,
size_t  virtual_size,
size_t  start_index = 0 
)

Initialize a Polynomial to size 'size', zeroing memory.

Constructors / Destructors

Parameters
sizeThe size of the polynomial.

Definition at line 73 of file polynomial.cpp.

◆ Polynomial() [2/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( size_t  size)
inline

Definition at line 188 of file polynomial.hpp.

◆ Polynomial() [3/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( size_t  size,
size_t  virtual_size,
size_t  start_index,
DontZeroMemory  flag 
)

Initialize a Polynomial to size 'size'. Important: This does NOT zero memory.

Parameters
sizeThe initial size of the polynomial.
flagSignals that we do not zero memory.

Definition at line 98 of file polynomial.cpp.

◆ Polynomial() [4/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( size_t  size,
size_t  virtual_size,
DontZeroMemory  flag 
)
inline

Definition at line 193 of file polynomial.hpp.

◆ Polynomial() [5/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( size_t  size,
DontZeroMemory  flag 
)
inline

Definition at line 196 of file polynomial.hpp.

◆ Polynomial() [6/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( const Polynomial< Fr > &  other)

◆ Polynomial() [7/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( const Polynomial< Fr > &  other,
size_t  target_size 
)

◆ Polynomial() [8/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( Polynomial< Fr > &&  other)
inlinenoexcept

Definition at line 207 of file polynomial.hpp.

◆ Polynomial() [9/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( std::span< const Fr coefficients,
size_t  virtual_size 
)

Definition at line 130 of file polynomial.cpp.

◆ Polynomial() [10/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( std::span< const Fr coefficients)
inline

Definition at line 217 of file polynomial.hpp.

◆ Polynomial() [11/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( )
default

◆ Polynomial() [12/12]

template<typename Fr >
bb::Polynomial< Fr >::Polynomial ( std::span< const Fr interpolation_points,
std::span< const Fr evaluations,
size_t  virtual_size 
)

Create the degree-(m-1) polynomial T(X) that interpolates the given evaluations. We have T(xⱼ) = yⱼ for j=1,...,m.

Parameters
interpolation_points(x₁,…,xₘ)
evaluations(y₁,…,yₘ)

Definition at line 117 of file polynomial.cpp.

◆ ~Polynomial()

template<typename Fr >
bb::Polynomial< Fr >::~Polynomial ( )
default

Member Function Documentation

◆ add_chunk()

template<typename Fr >
void bb::Polynomial< Fr >::add_chunk ( const ThreadChunk chunk,
PolynomialSpan< const Fr other 
)
inline

Definition at line 725 of file polynomial.hpp.

◆ add_masking()

template<typename Fr >
void bb::Polynomial< Fr >::add_masking ( )
inline

Write random ZK masking values at positions {1, 2, 3} (the disabled head region after the zero row).

Definition at line 651 of file polynomial.hpp.

◆ add_scaled()

template<typename Fr >
void bb::Polynomial< Fr >::add_scaled ( PolynomialSpan< const Fr other,
const Fr scaling_factor 
)
inline

adds the polynomial q(X) 'other', multiplied by a scaling factor.

Parameters
otherq(X)
scaling_factorscaling factor by which all coefficients of q(X) are multiplied

Definition at line 704 of file polynomial.hpp.

◆ add_scaled_chunk()

template<typename Fr >
void bb::Polynomial< Fr >::add_scaled_chunk ( const ThreadChunk chunk,
PolynomialSpan< const Fr other,
const Fr scaling_factor 
)
inline

Definition at line 675 of file polynomial.hpp.

◆ allocate_backing_memory()

template<typename Fr >
void bb::Polynomial< Fr >::allocate_backing_memory ( size_t  size,
size_t  virtual_size,
size_t  start_index 
)
private

Definition at line 52 of file polynomial.cpp.

◆ at() [1/2]

template<typename Fr >
Fr & bb::Polynomial< Fr >::at ( size_t  index)
inline

Our mutable accessor, unlike operator[]. We abuse precedent a bit to differentiate at() and operator[] as mutable and immutable, respectively. This means at() can only index within start_index()..end_index() unlike operator[] which can index 0..virtual_size.

Parameters
indexthe index, to be subtracted by start_index() and read into the array memory
Returns
Fr& a mutable reference.

Definition at line 417 of file polynomial.hpp.

◆ at() [2/2]

template<typename Fr >
const Fr & bb::Polynomial< Fr >::at ( size_t  index) const
inline

Definition at line 418 of file polynomial.hpp.

◆ coeffs() [1/2]

template<typename Fr >
std::span< Fr > bb::Polynomial< Fr >::coeffs ( size_t  offset = 0)
inline

Strictly iterates the defined region of the polynomial. We keep this explicit, instead of having an implicit conversion to span. This is safer as it is more likely that we need to consider our start_index() along with the span, as in PolynomialSpan below.

Returns
std::span<Fr> a span covering start_index() to end_index()

Definition at line 597 of file polynomial.hpp.

◆ coeffs() [2/2]

template<typename Fr >
std::span< const Fr > bb::Polynomial< Fr >::coeffs ( size_t  offset = 0) const
inline

Definition at line 598 of file polynomial.hpp.

◆ copy_vector()

template<typename Fr >
template<typename T >
void bb::Polynomial< Fr >::copy_vector ( const std::vector< T > &  vec)
inline

Copy over values from a vector that is of a convertible type.

Assumes that the relevant start index in the vector corresponds to the start_index of the destination polynomial and also that the number of elements we want to copy corresponds to the size of the polynomial. It is not intended to be a general-purpose method for vector copy and should be used with caution.

Template Parameters
Ta convertible type
Parameters
vecthe vector

Definition at line 639 of file polynomial.hpp.

◆ create_non_parallel_zero_init()

template<typename Fr >
Polynomial< Fr > bb::Polynomial< Fr >::create_non_parallel_zero_init ( size_t  size,
size_t  virtual_size 
)
static

A factory to construct a polynomial where parallel initialization is not possible (e.g. AVM code).

Returns
a polynomial initialized with zero on the range defined by size

Definition at line 193 of file polynomial.cpp.

◆ data() [1/2]

template<typename Fr >
Fr * bb::Polynomial< Fr >::data ( )
inline

Definition at line 406 of file polynomial.hpp.

◆ data() [2/2]

template<typename Fr >
const Fr * bb::Polynomial< Fr >::data ( ) const
inline

Definition at line 407 of file polynomial.hpp.

◆ end_index()

template<typename Fr >
size_t bb::Polynomial< Fr >::end_index ( ) const
inline

Definition at line 586 of file polynomial.hpp.

◆ evaluate()

template<typename Fr >
Fr bb::Polynomial< Fr >::evaluate ( const Fr z) const

Definition at line 177 of file polynomial.cpp.

◆ evaluate_mle()

template<typename Fr >
Fr bb::Polynomial< Fr >::evaluate_mle ( std::span< const Fr evaluation_points,
bool  shift = false 
) const

evaluate multi-linear extension p(X_0,…,X_{n-1}) = \sum_i a_i*L_i(X_0,…,X_{n-1}) at u = (u_0,…,u_{n-1}) If the polynomial is embedded into a lower dimension k<n, i.e, start_index + size <= 2^k, we evaluate it in a more efficient way. Note that a_j == 0 for any j >= 2^k. We fold over k dimensions and then multiply the result by (1 - u_k) * (1 - u_{k+1}) ... * (1 - u_{n-1}). In this case, for any i < 2^k, L_i is a multiple of (1 - X_k) * (1 - X_{k+1}) ... * (1 - X_{n-1}). Dividing p by this monomial leads to a multilinear extension over variables X_0, X_1, ..X_{k-1}.

this function allocates a temporary buffer of size 2^(k-1)

Parameters
evaluation_pointsevaluation vector of size n
shifta boolean and when set to true, we evaluate the shifted counterpart polynomial: enforce a_0 == 0 and compute \sum_i a_{i+1}*L_i(X_0,…,X_{n-1})

Definition at line 188 of file polynomial.cpp.

◆ factor_roots()

template<typename Fr >
void bb::Polynomial< Fr >::factor_roots ( const Fr root)
inline

Divides p(X) by (X-r) in-place. Assumes that p(rⱼ)=0 for all j.

we specialize the method when only a single root is given. if one of the roots is 0, then we first factor all other roots. dividing by X requires only a left shift of all coefficient.

Parameters
roota single root r

Definition at line 359 of file polynomial.hpp.

◆ full()

template<typename Fr >
Polynomial< Fr > bb::Polynomial< Fr >::full ( ) const

Copys the polynomial, but with the whole address space usable. The value of the polynomial remains the same, but defined memory region differs.

Returns
a polynomial with a larger size() but same virtual_size()

Definition at line 208 of file polynomial.cpp.

◆ get()

template<typename Fr >
const Fr & bb::Polynomial< Fr >::get ( size_t  i,
size_t  virtual_padding = 0 
) const
inline

Retrieves the value at the specified index.

Parameters
indexThe index from which to retrieve the value.
virtual_paddingFor the rare case where we explicitly want the 0-returning behavior beyond our usual virtual_size.

Definition at line 312 of file polynomial.hpp.

◆ increase_virtual_size()

template<typename Fr >
void bb::Polynomial< Fr >::increase_virtual_size ( const size_t  size_in)
inline

Definition at line 404 of file polynomial.hpp.

◆ indexed_values() [1/2]

template<typename Fr >
auto bb::Polynomial< Fr >::indexed_values ( )
inline

Definition at line 612 of file polynomial.hpp.

◆ indexed_values() [2/2]

template<typename Fr >
auto bb::Polynomial< Fr >::indexed_values ( ) const
inline

Definition at line 613 of file polynomial.hpp.

◆ indices()

template<typename Fr >
auto bb::Polynomial< Fr >::indices ( ) const
inline

Definition at line 611 of file polynomial.hpp.

◆ is_empty()

template<typename Fr >
bool bb::Polynomial< Fr >::is_empty ( ) const
inline

Definition at line 314 of file polynomial.hpp.

◆ is_shiftable()

template<typename Fr >
bool bb::Polynomial< Fr >::is_shiftable ( ) const
inline

Definition at line 587 of file polynomial.hpp.

◆ is_valid_set_index()

template<typename Fr >
bool bb::Polynomial< Fr >::is_valid_set_index ( size_t  index) const
inline

Is this index valid for a set? i.e. calling poly.at(index) = value.

Definition at line 617 of file polynomial.hpp.

◆ is_zero()

template<typename Fr >
bool bb::Polynomial< Fr >::is_zero ( ) const
inline

Check whether or not a polynomial is identically zero.

Definition at line 290 of file polynomial.hpp.

◆ multiply_chunk()

template<typename Fr >
void bb::Polynomial< Fr >::multiply_chunk ( const ThreadChunk chunk,
const Fr scaling_factor 
)
inline

Definition at line 778 of file polynomial.hpp.

◆ operator PolynomialSpan< const Fr >()

template<typename Fr >
bb::Polynomial< Fr >::operator PolynomialSpan< const Fr > ( ) const
inline

Convert to an std::span bundled with our start index.

Returns
PolynomialSpan<Fr> A span covering the entire polynomial.

Definition at line 609 of file polynomial.hpp.

◆ operator PolynomialSpan< Fr >()

template<typename Fr >
bb::Polynomial< Fr >::operator PolynomialSpan< Fr > ( )
inline

Convert to an std::span bundled with our start index.

Returns
PolynomialSpan<Fr> A span covering the entire polynomial.

Definition at line 603 of file polynomial.hpp.

◆ operator*=()

template<typename Fr >
Polynomial< Fr > & bb::Polynomial< Fr >::operator*= ( const Fr scaling_factor)
inline

sets this = p(X) to s⋅p(X)

Parameters
scaling_factors

Definition at line 791 of file polynomial.hpp.

◆ operator+=()

template<typename Fr >
Polynomial< Fr > & bb::Polynomial< Fr >::operator+= ( PolynomialSpan< const Fr other)
inline

adds the polynomial q(X) 'other'.

Parameters
otherq(X)

Definition at line 737 of file polynomial.hpp.

◆ operator-=()

template<typename Fr >
Polynomial< Fr > & bb::Polynomial< Fr >::operator-= ( PolynomialSpan< const Fr other)
inline

subtracts the polynomial q(X) 'other'.

Parameters
otherq(X)

Definition at line 763 of file polynomial.hpp.

◆ operator=() [1/2]

template<typename Fr >
Polynomial & bb::Polynomial< Fr >::operator= ( const Polynomial< Fr > &  other)

◆ operator=() [2/2]

template<typename Fr >
Polynomial & bb::Polynomial< Fr >::operator= ( Polynomial< Fr > &&  other)
inlinenoexcept

Definition at line 268 of file polynomial.hpp.

◆ operator==()

template<typename Fr >
bool bb::Polynomial< Fr >::operator== ( Polynomial< Fr > const rhs) const

Definition at line 156 of file polynomial.cpp.

◆ operator[]() [1/8]

template<typename Fr >
template<size_t N, typename U = Fr>
ContiguousVectorWriteProxyT< typename U::Params > bb::Polynomial< Fr >::operator[] ( ContiguousVectorIndex< N ctx)
inline

Definition at line 538 of file polynomial.hpp.

◆ operator[]() [2/8]

template<typename Fr >
template<size_t N, typename U = Fr>
VectorField< typename U::Params > bb::Polynomial< Fr >::operator[] ( ContiguousVectorIndex< N ctx) const
inline

Definition at line 524 of file polynomial.hpp.

◆ operator[]() [3/8]

Definition at line 531 of file polynomial.hpp.

◆ operator[]() [4/8]

template<typename Fr >
Fr bb::Polynomial< Fr >::operator[] ( ScalarIndex  ctx) const
inline

Definition at line 509 of file polynomial.hpp.

◆ operator[]() [5/8]

template<typename Fr >
const Fr & bb::Polynomial< Fr >::operator[] ( size_t  i)
inline

Definition at line 420 of file polynomial.hpp.

◆ operator[]() [6/8]

template<typename Fr >
const Fr & bb::Polynomial< Fr >::operator[] ( size_t  i) const
inline

Definition at line 421 of file polynomial.hpp.

◆ operator[]() [7/8]

template<typename Fr >
template<size_t N, typename U = Fr>
VectorWriteProxyT< typename U::Params > bb::Polynomial< Fr >::operator[] ( VectorIndex< N ctx)
inline

Definition at line 532 of file polynomial.hpp.

◆ operator[]() [8/8]

template<typename Fr >
template<size_t N, typename U = Fr>
VectorField< typename U::Params > bb::Polynomial< Fr >::operator[] ( VectorIndex< N ctx) const
inline

Definition at line 515 of file polynomial.hpp.

◆ random() [1/2]

template<typename Fr >
static Polynomial bb::Polynomial< Fr >::random ( size_t  size,
size_t  start_index = 0 
)
inlinestatic

Definition at line 544 of file polynomial.hpp.

◆ random() [2/2]

template<typename Fr >
static Polynomial bb::Polynomial< Fr >::random ( size_t  size,
size_t  virtual_size,
size_t  start_index 
)
inlinestatic

Definition at line 551 of file polynomial.hpp.

◆ reverse()

template<typename Fr >
Polynomial< Fr > bb::Polynomial< Fr >::reverse ( ) const

Returns the polynomial equal to the reverse of self.

If the coefficients of self are \((a_0, \dots, a_n)\), we return the polynomial with coefficients \((a_n, \dots, a_0)\)

Note
Resulting polynomial uses new backing memory; n = self->size()

Definition at line 231 of file polynomial.cpp.

◆ set_if_valid_index()

template<typename Fr >
void bb::Polynomial< Fr >::set_if_valid_index ( size_t  index,
const Fr value 
)
inline

Like setting with at(), but allows zeroes to result in no set.

Definition at line 621 of file polynomial.hpp.

◆ share()

template<typename Fr >
Polynomial< Fr > bb::Polynomial< Fr >::share ( ) const

Return a shallow clone of the polynomial. i.e. underlying memory is shared.

Definition at line 149 of file polynomial.cpp.

◆ shiftable() [1/3]

template<typename Fr >
static Polynomial bb::Polynomial< Fr >::shiftable ( size_t  size,
size_t  virtual_size,
bool  masked = false 
)
inlinestatic

Utility to create a shiftable polynomial of given size and virtual size.

Parameters
maskedIf true, write random values at positions {1,2,3} for ZK masking.

Definition at line 238 of file polynomial.hpp.

◆ shiftable() [2/3]

template<typename Fr >
static Polynomial bb::Polynomial< Fr >::shiftable ( size_t  size,
size_t  virtual_size,
DontZeroMemory  flag 
)
inlinestatic

Overload of shiftable that leaves the backing memory uninitialized.

Use only when the caller writes every cell in [NUM_ZERO_ROWS, NUM_ZERO_ROWS + size) before any read.

Definition at line 251 of file polynomial.hpp.

◆ shiftable() [3/3]

template<typename Fr >
static Polynomial bb::Polynomial< Fr >::shiftable ( size_t  virtual_size,
bool  masked = false 
)
inlinestatic

Utility to create a shiftable polynomial of given virtual size.

Parameters
maskedIf true, write random values at positions {1,2,3} for ZK masking.

Definition at line 225 of file polynomial.hpp.

◆ shifted()

template<typename Fr >
Polynomial< Fr > bb::Polynomial< Fr >::shifted ( ) const

Returns a Polynomial the left-shift of self.

If the n coefficients of self are (0, a₁, …, aₙ₋₁), we returns the view of the n-1 coefficients (a₁, …, aₙ₋₁).

Definition at line 221 of file polynomial.cpp.

◆ shrink_end_index()

template<typename Fr >
void bb::Polynomial< Fr >::shrink_end_index ( const size_t  new_end_index)

The end_index of the polynomial is decreased without any memory de-allocation. This is a very fast way to zeroize the polynomial tail from new_end_index to the end. It also means that the new end_index might be smaller than the backed memory.

Definition at line 200 of file polynomial.cpp.

◆ size()

template<typename Fr >
std::size_t bb::Polynomial< Fr >::size ( ) const
inline

Definition at line 402 of file polynomial.hpp.

◆ start_index()

template<typename Fr >
size_t bb::Polynomial< Fr >::start_index ( ) const
inline

Definition at line 585 of file polynomial.hpp.

◆ subtract_chunk()

template<typename Fr >
void bb::Polynomial< Fr >::subtract_chunk ( const ThreadChunk chunk,
PolynomialSpan< const Fr other 
)
inline

Definition at line 750 of file polynomial.hpp.

◆ virtual_size()

template<typename Fr >
std::size_t bb::Polynomial< Fr >::virtual_size ( ) const
inline

Definition at line 403 of file polynomial.hpp.

Member Data Documentation

◆ coefficients_

template<typename Fr >
SharedShiftedVirtualZeroesArray<Fr> bb::Polynomial< Fr >::coefficients_
private

Definition at line 665 of file polynomial.hpp.


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