46 const fr x_sqr = fr_vec[0].
sqr();
47 const fr y = fr_vec[1];
69 "field_conversion: convert_challenge");
87 static constexpr bb::fr shift(
static_cast<uint256_t>(1) << NUM_LIMB_BITS);
88 std::vector<fr> result(2);
104 return 2 * calc_num_fields<typename T::BaseField>();
107 return calc_num_fields<typename T::value_type>() * (std::tuple_size<T>::value);
148 using bigfield_ct =
fq;
150 constexpr size_t expected_size = calc_num_fields<T>();
153 ASSERT(validate_context<Builder>(fr_vec));
160 return T(fr_vec[0], fr_vec[1]);
163 using Basefield =
typename T::BaseField;
165 constexpr size_t base_field_frs = expected_size / 2;
167 Basefield x = deserialize_from_fields<Basefield>(fr_vec.subspan(0, base_field_frs));
168 Basefield y = deserialize_from_fields<Basefield>(fr_vec.subspan(base_field_frs, base_field_frs));
170 T out(x, y, check_point_at_infinity<T>(fr_vec));
173 out.validate_on_curve();
178 using element_type =
typename T::value_type;
179 const size_t scalar_frs = calc_num_fields<element_type>();
182 for (
auto& x : val) {
183 x = deserialize_from_fields<element_type>(fr_vec.subspan(scalar_frs * i, scalar_frs));
243 using bigfield_ct =
fq;
252 using BaseField =
typename T::BaseField;
257 fr_vec.insert(fr_vec.end(), fr_vec_y.begin(), fr_vec_y.end());
262 for (
auto& x : val) {
263 auto tmp_vec = serialize_to_fields<typename T::value_type>(x);
264 fr_vec.insert(fr_vec.end(), tmp_vec.begin(), tmp_vec.end());
279 const size_t lo_bits = fr::native::Params::MAX_BITS_PER_ENDOMORPHISM_SCALAR;
297 constexpr size_t num_frs = calc_num_fields<TargetType>();
299 TargetType result = deserialize_from_fields<TargetType>(elements.subspan(num_frs_read, num_frs));
300 num_frs_read += num_frs;
#define BB_ASSERT_GTE(left, right,...)
#define BB_ASSERT_EQ(actual, expected,...)
#define BB_ASSERT_LT(left, right,...)
#define ASSERT(expression,...)
static constexpr size_t NUM_BN254_SCALARS
static constexpr size_t NUM_BN254_SCALARS
constexpr uint64_t get_msb() const
static constexpr size_t calc_num_fields()
Calculates the size of a type (in its native form) in terms of frs.
bigfield< Builder, bb::Bn254FqParams > fq
typename Field::Builder Builder
static std::vector< fr > convert_goblin_fr_to_bn254_frs(const goblin_field< Builder > &input)
static std::vector< fr > convert_grumpkin_fr_to_bn254_frs(const fq &input)
static bool_t< Builder > check_point_at_infinity(std::span< const fr > fr_vec)
Check whether a point corresponds to (0, 0), the conventional representation of the point infinity.
static T convert_challenge(const fr &challenge)
A stdlib Transcript method needed to convert an fr challenge to a bigfield one. Assumes that challeng...
static std::array< fr, 2 > split_challenge(const fr &challenge)
Split a challenge field element into two half-width challenges.
static T deserialize_from_fields(std::span< const fr > fr_vec)
Core stdlib Transcript deserialization method.
static TargetType deserialize_from_frs(std::span< fr > elements, size_t &num_frs_read)
A stdlib VerificationKey-specific method.
static std::vector< fr > serialize_to_fields(const T &val)
Core stdlib Transcript serialization method.
element< Builder, fq, fr, curve::BN254::Group > bn254_element
static constexpr uint64_t NUM_LIMB_BITS
std::array< Limb, NUM_LIMBS > binary_basis_limbs
Represents a bigfield element in the binary basis. A bigfield element is represented as a combination...
Implements boolean logic in-circuit.
cycle_group represents a group Element of the proving system's embedded curve, i.e....
field_t madd(const field_t &to_mul, const field_t &to_add) const
static field_t from_witness_index(Builder *ctx, uint32_t witness_index)
static field_t accumulate(const std::vector< field_t > &input)
Efficiently compute the sum of vector entries. Using big_add_gate we reduce the number of gates neede...
Builder * get_context() const
bb::fr get_value() const
Given a := *this, compute its value given by a.v * a.mul + a.add.
bool_t< Builder > is_zero() const
Validate whether a field_t element is zero.
goblin_field wraps x/y coordinates of bn254 group elements when using goblin
std::array< field_ct, 2 > limbs
std::pair< field_t< Builder >, field_t< Builder > > split_unique(const field_t< Builder > &field, const size_t lo_bits, const bool skip_range_constraints)
Split a bn254 scalar field element into unique lo and hi limbs.
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...
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept