barretenberg
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
barretenberg::RelationUtils< Flavor > Class Template Reference

Public Types

using FF = typename Flavor::FF
 
using Relations = typename Flavor::Relations
 
using PolynomialEvaluations = typename Flavor::AllValues
 
using RelationEvaluations = typename Flavor::TupleOfArraysOfValues
 

Static Public Member Functions

template<size_t outer_idx = 0, size_t inner_idx = 0, class Operation >
static void apply_to_tuple_of_tuples (auto &tuple, Operation &&operation)
 General purpose method for applying an operation to a tuple of tuples of Univariates.
 
static void zero_univariates (auto &tuple)
 Set all coefficients of Univariates to zero.
 
static void scale_univariates (auto &tuple, const FF &challenge, FF &current_scalar)
 Scale Univaraites by consecutive powers of the provided challenge.
 
template<typename... T>
static constexpr void add_tuples (std::tuple< T... > &tuple_1, const std::tuple< T... > &tuple_2)
 Componentwise addition of two tuples.
 
template<typename Tuple , std::size_t Index = 0>
static constexpr void add_nested_tuples (Tuple &tuple_1, const Tuple &tuple_2)
 Componentwise addition of nested tuples (tuples of tuples)
 
template<typename Parameters , size_t relation_idx = 0>
static void accumulate_relation_evaluations (PolynomialEvaluations evaluations, RelationEvaluations &relation_evaluations, const Parameters &relation_parameters, const FF &partial_evaluation_constant)
 Calculate the contribution of each relation to the expected value of the full Honk relation.
 
template<size_t idx = 0>
static void zero_elements (auto &tuple)
 Set each element in a tuple of arrays to zero.
 
static void scale_and_batch_elements (auto &tuple, const FF &challenge, FF current_scalar, FF &result)
 Scale elements by consecutive powers of the challenge then sum.
 
template<typename Operation , size_t idx = 0, typename... Ts>
static void apply_to_tuple_of_arrays (Operation &&operation, std::tuple< Ts... > &tuple)
 General purpose method for applying a tuple of arrays (of FFs)
 

Static Public Attributes

static constexpr size_t NUM_RELATIONS = Flavor::NUM_RELATIONS
 

Member Function Documentation

◆ accumulate_relation_evaluations()

template<typename Flavor >
template<typename Parameters , size_t relation_idx = 0>
static void barretenberg::RelationUtils< Flavor >::accumulate_relation_evaluations ( PolynomialEvaluations  evaluations,
RelationEvaluations &  relation_evaluations,
const Parameters &  relation_parameters,
const FF &  partial_evaluation_constant 
)
inlinestatic

Calculate the contribution of each relation to the expected value of the full Honk relation.

For each relation, use the purported values (supplied by the prover) of the multivariates to calculate a contribution to the purported value of the full Honk relation. These are stored in evaluations. Adding these together, with appropriate scaling factors, produces the expected value of the full Honk relation. This value is checked against the final value of the target total sum (called sigma_0 in the thesis).

◆ add_nested_tuples()

template<typename Flavor >
template<typename Tuple , std::size_t Index = 0>
static constexpr void barretenberg::RelationUtils< Flavor >::add_nested_tuples ( Tuple &  tuple_1,
const Tuple &  tuple_2 
)
inlinestaticconstexpr

Componentwise addition of nested tuples (tuples of tuples)

Used for summing tuples of tuples of Univariates. Needed for Sumcheck multithreading. Each thread accumulates relation contributions across a portion of the hypecube and then the results are accumulated into a single nested tuple.

Template Parameters
Tuple
IndexIndex into outer tuple
Parameters
tuple_1First nested tuple summand. Result stored here
tuple_2Second summand

◆ add_tuples()

template<typename Flavor >
template<typename... T>
static constexpr void barretenberg::RelationUtils< Flavor >::add_tuples ( std::tuple< T... > &  tuple_1,
const std::tuple< T... > &  tuple_2 
)
inlinestaticconstexpr

Componentwise addition of two tuples.

Used for adding tuples of Univariates but in general works for any object for which += is defined. The result is stored in the first tuple.

Template Parameters
TType of the elements contained in the tuples
Parameters
tuple_1First summand. Result stored in this tuple
tuple_2Second summand

◆ apply_to_tuple_of_arrays()

template<typename Flavor >
template<typename Operation , size_t idx = 0, typename... Ts>
static void barretenberg::RelationUtils< Flavor >::apply_to_tuple_of_arrays ( Operation &&  operation,
std::tuple< Ts... > &  tuple 
)
inlinestatic

General purpose method for applying a tuple of arrays (of FFs)

Template Parameters
OperationAny operation valid on elements of the inner arrays (FFs)
Parameters
tupleTuple of arrays (of FFs)

◆ apply_to_tuple_of_tuples()

template<typename Flavor >
template<size_t outer_idx = 0, size_t inner_idx = 0, class Operation >
static void barretenberg::RelationUtils< Flavor >::apply_to_tuple_of_tuples ( auto &  tuple,
Operation &&  operation 
)
inlinestatic

General purpose method for applying an operation to a tuple of tuples of Univariates.

Utility methods for tuple of tuples of Univariates

Template Parameters
OperationAny operation valid on Univariates
outer_idxIndex into the outer tuple
inner_idxIndex into the inner tuple
Parameters
tupleA Tuple of tuples of Univariates
operationOperation to apply to Univariates

◆ scale_and_batch_elements()

template<typename Flavor >
static void barretenberg::RelationUtils< Flavor >::scale_and_batch_elements ( auto &  tuple,
const FF &  challenge,
FF  current_scalar,
FF &  result 
)
inlinestatic

Scale elements by consecutive powers of the challenge then sum.

Parameters
resultBatched result

◆ scale_univariates()

template<typename Flavor >
static void barretenberg::RelationUtils< Flavor >::scale_univariates ( auto &  tuple,
const FF &  challenge,
FF &  current_scalar 
)
inlinestatic

Scale Univaraites by consecutive powers of the provided challenge.

Parameters
tupleTuple of tuples of Univariates
challenge
current_scalarpower of the challenge

◆ zero_elements()

template<typename Flavor >
template<size_t idx = 0>
static void barretenberg::RelationUtils< Flavor >::zero_elements ( auto &  tuple)
inlinestatic

Set each element in a tuple of arrays to zero.

Utility methods for tuple of arrays

FF's default constructor may not initialize to zero (e.g., barretenberg::fr), hence we can't rely on aggregate initialization of the evaluations array.

◆ zero_univariates()

template<typename Flavor >
static void barretenberg::RelationUtils< Flavor >::zero_univariates ( auto &  tuple)
inlinestatic

Set all coefficients of Univariates to zero.

After computing the round univariate, it is necessary to zero-out the accumulators used to compute it.


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