117 static constexpr std::array<bool, 3>
142 return (row.q_lookup == 1) || (row.lookup_read_tags == 1);
166 template <
typename Accumulator,
typename AllEntities>
169 using CoefficientAccumulator =
typename Accumulator::CoefficientAccumulator;
180 return Accumulator(-(row_has_write * row_has_read) + row_has_write + row_has_read);
200 template <
typename Accumulator,
typename AllEntities,
typename Parameters>
203 using ParameterCoefficientAccumulator =
typename Parameters::DataType::CoefficientAccumulator;
204 using CoefficientAccumulator =
typename Accumulator::CoefficientAccumulator;
206 const auto gamma = ParameterCoefficientAccumulator(params.gamma);
207 const auto beta = ParameterCoefficientAccumulator(params.beta);
208 const auto beta_sqr = ParameterCoefficientAccumulator(params.beta_sqr);
209 const auto beta_cube = ParameterCoefficientAccumulator(params.beta_cube);
217 auto result = (table_2 * beta) + (table_3 * beta_sqr) + (table_4 * beta_cube);
223 template <
typename Accumulator,
typename AllEntities,
typename Parameters>
226 using ParameterCoefficientAccumulator =
typename Parameters::DataType::CoefficientAccumulator;
227 using CoefficientAccumulator =
typename Accumulator::CoefficientAccumulator;
229 const auto gamma = ParameterCoefficientAccumulator(params.gamma);
230 const auto beta = ParameterCoefficientAccumulator(params.beta);
231 const auto beta_sqr = ParameterCoefficientAccumulator(params.beta_sqr);
232 const auto beta_cube = ParameterCoefficientAccumulator(params.beta_cube);
251 auto derived_table_entry_1 = (negative_column_1_step_size * w_1_shift) + (w_1 + gamma);
253 auto derived_table_entry_2 = (negative_column_2_step_size * w_2_shift) + w_2;
255 auto derived_table_entry_3 = (negative_column_3_step_size * w_3_shift) + w_3;
257 auto table_index_entry = table_index * beta_cube;
278 template <
typename Polynomials>
280 auto& relation_parameters,
281 const size_t circuit_size,
282 const size_t start_index = 0)
287 const size_t num_rows = circuit_size - start_index;
288 size_t min_iterations_per_thread = 1 << 6;
293 for (
size_t j : chunk.
range(num_rows)) {
294 size_t i = j + start_index;
296 if (polynomials.q_lookup().get(i) == 1 || polynomials.lookup_read_tags().get(i) == 1) {
298 auto row = polynomials.get_row(i);
299 auto value = compute_lookup_term<FF>(row, relation_parameters) *
300 compute_table_term<FF>(row, relation_parameters);
301 inverse_polynomial.at(i) =
value;
319 template <
typename ContainerOverSubrelations,
typename AllEntities,
typename Parameters>
320 static void accumulate(ContainerOverSubrelations& accumulator,
322 const Parameters& params,
323 const FF& scaling_factor)
330 using ShortView =
typename ShortAccumulator::View;
333 using CoefficientAccumulator =
typename Accumulator::CoefficientAccumulator;
343 const auto inverse_exists = compute_inverse_exists<Accumulator>(in);
344 const auto lookup_term = compute_lookup_term<Accumulator>(in, params);
345 const auto table_term = compute_table_term<Accumulator>(in, params);
350 const Accumulator logderiv_first_term = (lookup_term * table_term * inverses - inverse_exists) * scaling_factor;
351 std::get<0>(accumulator) += ShortView(logderiv_first_term);
363 const auto read_tag = BooleanCheckerAccumulator(read_tag_m);
365 std::get<2>(accumulator) += (read_tag * read_tag - read_tag) * scaling_factor;
#define BB_BENCH_NAME(name)
#define BB_BENCH_TRACY_NAME(name)
Log-derivative lookup argument relation for establishing lookup reads from tables with 3 or fewer col...
static constexpr std::array< size_t, 3 > SUBRELATION_PARTIAL_LENGTHS
static bool operation_exists_at_row(const AllValues &row)
Does the provided row contain data relevant to table lookups.
static constexpr size_t TABLE_TERMS
static constexpr size_t LOOKUP_SUBRELATION_LENGTH
static void accumulate(ContainerOverSubrelations &accumulator, const AllEntities &in, const Parameters ¶ms, const FF &scaling_factor)
Accumulate the subrelation contributions for reads from a lookup table.
static Accumulator compute_inverse_exists(const AllEntities &in)
Compute the Accumulator whose values indicate whether the inverse is computed or not.
static constexpr size_t INVERSE_SUBRELATION_LENGTH
static Accumulator compute_table_term(const AllEntities &in, const Parameters ¶ms)
Compute the table term.
static void compute_logderivative_inverse(Polynomials &polynomials, auto &relation_parameters, const size_t circuit_size, const size_t start_index=0)
Construct the polynomial whose components are the inverse of the product of the read and write terms...
static constexpr bool HAS_LOGDERIVATIVE_INVERSE_COMPUTATION
static constexpr std::array< bool, 3 > SUBRELATION_LINEARLY_INDEPENDENT
static bool skip(const AllEntities &in)
static Accumulator compute_lookup_term(const AllEntities &in, const Parameters ¶ms)
static auto & get_inverse_polynomial(AllEntities &in)
static constexpr size_t BOOLEAN_CHECK_SUBRELATION_LENGTH
DataType & lookup_read_counts()
DataType & lookup_inverses()
DataType & lookup_read_tags()
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
Entry point for Barretenberg command-line interface.
size_t calculate_num_threads(size_t num_iterations, size_t min_iterations_per_thread)
calculates number of threads to create based on minimum iterations per thread
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
auto range(size_t size, size_t offset=0) const
static void batch_invert(C &coeffs) noexcept
Batch invert a collection of field elements using Montgomery's trick.