21 static_assert((base::modulus.data[0] & 0x3UL) == 0x3UL);
22 base t1 = c0 * other.
c0;
23 base t2 = c1 * other.c1;
25 base t4 = other.c0 + other.c1;
27 return { t1 - t2, t3 * t4 - (t1 + t2) };
32 return { c0 + other.
c0, c1 + other.c1 };
37 return { c0 - other.
c0, c1 - other.c1 };
70 *
this = operator/(other);
77 return { (c0 + c1) * (c0 - c1), t1 + t1 };
98 c1.self_to_montgomery_form();
103 c0.self_from_montgomery_form();
104 c1.self_from_montgomery_form();
128 field2 accumulator = *
this;
130 const uint64_t maximum_set_bit = exponent.get_msb();
132 for (
int i =
static_cast<int>(maximum_set_bit) - 1; i >= 0; --i) {
134 if (exponent.get_bit(
static_cast<uint64_t
>(i))) {
135 accumulator *= to_mul;
139 if (*
this == zero()) {
140 accumulator = zero();
149 return pow({ exponent, 0, 0, 0 });
154 base t3 = (c0.sqr() + c1.sqr()).invert();
155 return { c0 * t3, -(c1 * t3) };
158template <
class base,
class T>
161 *
this = predicate != 0U ? -(*this) : *
this;
166 c0.data[3] = 0ULL | (1ULL << 63ULL);
171 return (c0.data[3] >> 63ULL) == 1ULL;
176 return (c0.data[3] >> 63ULL);
181 return (c0.is_zero() && c1.is_zero());
186 return (c0 == other.c0) && (c1 == other.c1);
201 return { base::random_element(
engine), base::random_element(
engine) };
Entry point for Barretenberg command-line interface.
Univariate< Fr, domain_end, domain_start, skip_count > operator+(const Fr &ff, const Univariate< Fr, domain_end, domain_start, skip_count > &uv)
Univariate< Fr, domain_end, domain_start, skip_count > operator*(const Fr &ff, const Univariate< Fr, domain_end, domain_start, skip_count > &uv)
Univariate< Fr, domain_end, domain_start, skip_count > operator-(const Fr &ff, const Univariate< Fr, domain_end, domain_start, skip_count > &uv)
constexpr void self_set_msb() noexcept
constexpr void self_conditional_negate(uint64_t predicate) noexcept
constexpr void self_to_montgomery_form() noexcept
constexpr bool operator==(const field2 &other) const noexcept
constexpr field2 sqr() const noexcept
constexpr field2 operator/=(const field2 &other) noexcept
constexpr field2 operator-=(const field2 &other) noexcept
constexpr field2 to_montgomery_form() const noexcept
constexpr void self_from_montgomery_form() noexcept
constexpr void self_reduce_once() noexcept
constexpr void self_neg() noexcept
constexpr field2 operator*=(const field2 &other) noexcept
constexpr field2 operator-() const noexcept
constexpr field2 operator+(const field2 &other) const noexcept
constexpr void self_frobenius_map() noexcept
constexpr field2 invert() const noexcept
constexpr bool is_msb_set() const noexcept
constexpr field2 operator+=(const field2 &other) noexcept
constexpr field2 operator/(const field2 &other) const noexcept
static field2 random_element(numeric::RNG *engine=nullptr)
constexpr field2 from_montgomery_form() const noexcept
constexpr bool is_zero() const noexcept
constexpr void self_sqr() noexcept
constexpr field2 pow(const uint256_t &exponent) const noexcept
constexpr field2 reduce_once() const noexcept
constexpr uint64_t is_msb_set_word() const noexcept
constexpr field2 operator*(const field2 &other) const noexcept
constexpr field2 frobenius_map() const noexcept