26template <
typename Builder>
29 const Element& offset_generator,
32 const size_t table_size = 1UL << table_bits;
33 Element base = base_point.is_point_at_infinity() ? Group::one : base_point;
34 std::vector<Element> hints;
35 hints.emplace_back(offset_generator);
36 for (
size_t i = 1; i < table_size; ++i) {
37 hints.emplace_back(hints[i - 1] + base);
56template <
typename Builder>
62 : _table_bits(table_bits)
64 , tag(
OriginTag(base_point.get_origin_tag(), offset_generator.get_origin_tag()))
68 const size_t table_size = 1UL << table_bits;
91 for (
size_t i = 1; i < table_size; ++i) {
99 for (
size_t i = 1; i < table_size; ++i) {
102 x_coordinate_checks.emplace_back(
point_table[i - 1].x, modded_base_point.
x);
108 field_t coordinate_check_product = 1;
109 for (
auto& [x1, x2] : x_coordinate_checks) {
110 auto x_diff = x2 - x1;
111 coordinate_check_product *= x_diff;
113 coordinate_check_product.
assert_is_not_zero(
"straus_lookup_table x-coordinate collision");
115 for (
size_t i = 1; i < table_size; ++i) {
120 if constexpr (IS_ULTRA) {
122 for (
size_t i = 0; i < table_size; ++i) {
150 if constexpr (IS_ULTRA) {
157 auto output_indices = _context->read_ROM_array_pair(rom_id, index.
get_witness_index());
165 field_t x = _index * (point_table[1].x - point_table[0].x) + point_table[0].x;
166 field_t y = _index * (point_table[1].y - point_table[0].y) + point_table[0].y;
#define BB_ASSERT_EQ(actual, expected,...)
cycle_group represents a group Element of the proving system's embedded curve i.e....
static cycle_group from_constant_witness(Builder *_context, const AffineElement &_in)
Converts a native AffineElement into a witness, but constrains the witness values to be known constan...
static cycle_group conditional_assign(const bool_t &predicate, const cycle_group &lhs, const cycle_group &rhs)
bool_t is_point_at_infinity() const
AffineElement get_value() const
void assert_equal(const field_t &rhs, std::string const &msg="field_t::assert_equal") const
Copy constraint: constrain that *this field is equal to rhs element.
static field_t from_witness_index(Builder *ctx, uint32_t witness_index)
static field_t conditional_assign(const bool_t< Builder > &predicate, const field_t &lhs, const field_t &rhs)
If predicate == true then return lhs, else return rhs.
OriginTag get_origin_tag() const
bb::fr get_value() const
Given a := *this, compute its value given by a.v * a.mul + a.add.
void set_origin_tag(const OriginTag &new_tag) const
void assert_is_not_zero(std::string const &msg="field_t::assert_is_not_zero") const
Constrain *this to be non-zero by establishing that it has an inverse.
uint32_t get_witness_index() const
Get the witness index of the current field element.
straus_lookup_table computes a lookup table of size 1 << table_bits
typename Curve::Element Element
std::vector< cycle_group< Builder > > point_table
straus_lookup_table()=default
cycle_group< Builder > read(const field_t &index)
Given an _index witness, return straus_lookup_table[index]
StrictMock< MockContext > context
std::conditional_t< IsGoblinBigGroup< C, Fq, Fr, G >, element_goblin::goblin_element< C, goblin_field< C >, Fr, G >, element_default::element< C, Fq, Fr, G > > element
element wraps either element_default::element or element_goblin::goblin_element depending on parametr...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept