barretenberg
Loading...
Searching...
No Matches
dummy.hpp
Go to the documentation of this file.
1#pragma once
10#include "types.hpp"
11
12namespace plookup {
13namespace dummy_tables {
14
26template <uint64_t id> inline std::array<barretenberg::fr, 2> get_value_from_key(const std::array<uint64_t, 2> key)
27{
28 return { key[0] * 3 + key[1] * 4 + id * 0x1337ULL, 0ULL };
29}
30
42template <uint64_t table_id>
43inline BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
44{
45
46 // We do the assertion, since this function is templated, but the general API for these functions contains the id,
47 // too. This helps us ensure that the correct instantion is used for a particular BasicTableId
48 ASSERT(table_id == static_cast<uint64_t>(id));
49 const size_t base = 1 << 1; // Probably has to be a power of 2
50 BasicTable table;
51 table.id = id;
52 table.table_index = table_index;
53 table.size = base * base;
54 table.use_twin_keys = true;
55 for (uint64_t i = 0; i < base; ++i) {
56 for (uint64_t j = 0; j < base; ++j) {
57 table.column_1.emplace_back(i);
58 table.column_2.emplace_back(j);
59 table.column_3.emplace_back(i * 3 + j * 4 + static_cast<uint64_t>(id) * 0x1337ULL);
60 }
61 }
62
63 table.get_values_from_key = &get_value_from_key<table_id>;
64
65 table.column_1_step_size = base;
66 table.column_2_step_size = base;
67 table.column_3_step_size = base;
68
69 return table;
70}
79{
80 const MultiTableId id = HONK_DUMMY_MULTI;
81 const size_t number_of_elements_in_argument = 1 << 1; // Probably has to be a power of 2
82 const size_t number_of_lookups = 2;
83 MultiTable table(number_of_elements_in_argument,
84 number_of_elements_in_argument,
85 number_of_elements_in_argument,
86 number_of_lookups);
87 table.id = id;
88 table.slice_sizes.emplace_back(number_of_elements_in_argument);
89 table.lookup_ids.emplace_back(HONK_DUMMY_BASIC1);
90 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC1>);
91 table.slice_sizes.emplace_back(number_of_elements_in_argument);
92 table.lookup_ids.emplace_back(HONK_DUMMY_BASIC2);
93 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC2>);
94 return table;
95}
96} // namespace dummy_tables
97} // namespace plookup
MultiTable get_honk_dummy_multitable()
Create a multitable for filling UltraHonk polynomials with non-zero values.
Definition: dummy.hpp:78
BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
Generate the whole table.
Definition: dummy.hpp:43
std::array< barretenberg::fr, 2 > get_value_from_key(const std::array< uint64_t, 2 > key)
Lookup the value corresponding to a specific key.
Definition: dummy.hpp:26
The structure contains the most basic table serving one function (for, example an xor table)
Definition: types.hpp:263
Definition: types.hpp:124