3#include "affine_element.hpp"
4#include "barretenberg/common/compiler_hints.hpp"
5#include "barretenberg/common/mem.hpp"
6#include "barretenberg/numeric/random/engine.hpp"
7#include "barretenberg/numeric/uint256/uint256.hpp"
13namespace barretenberg::group_elements {
27template <
class Fq,
class Fr,
class Params>
class alignas(32)
element {
29 static constexpr Fq curve_b = Params::b;
33 constexpr element(
const Fq& a,
const Fq& b,
const Fq& c)
noexcept;
37 constexpr ~element()
noexcept =
default;
39 static constexpr element one()
noexcept {
return { Params::one_x, Params::one_y, Fq::one() }; };
40 static constexpr element zero()
noexcept
43 zero.self_set_infinity();
54 constexpr element dbl()
const noexcept;
55 constexpr void self_dbl()
noexcept;
65 constexpr element operator-()
const noexcept;
78 element operator*(
const Fr& exponent)
const noexcept;
79 element operator*=(
const Fr& exponent)
noexcept;
85 constexpr element normalize()
const noexcept;
87 BBERG_INLINE
constexpr element set_infinity()
const noexcept;
88 BBERG_INLINE
constexpr void self_set_infinity()
noexcept;
89 [[nodiscard]] BBERG_INLINE
constexpr bool is_point_at_infinity()
const noexcept;
90 [[nodiscard]] BBERG_INLINE
constexpr bool on_curve()
const noexcept;
91 BBERG_INLINE
constexpr bool operator==(
const element& other)
const noexcept;
94 static std::vector<affine_element<Fq, Fr, Params>> batch_mul_with_endomorphism(
102 element mul_without_endomorphism(
const Fr& exponent)
const noexcept;
103 element mul_with_endomorphism(
const Fr& exponent)
const noexcept;
105 template <
typename =
typename std::enable_if<Params::can_hash_to_curve>>
126 MSGPACK_FIELDS(x, y, z);
130 uint64_t predicate)
noexcept;
132 friend std::ostream& operator<<(std::ostream& os,
const element& a)
134 os <<
"{ " << a.x <<
", " << a.y <<
", " << a.z <<
" }";
139template <
class Fq,
class Fr,
class Params> std::ostream& operator<<(std::ostream& os,
element<Fq, Fr, Params> const& e)
141 return os <<
"x:" << e.x <<
" y:" << e.y <<
" z:" << e.z;
149#include "./element_impl.hpp"
151template <
class Fq,
class Fr,
class Params>
159template <
class Fq,
class Fr,
class Params>
Definition: affine_element.hpp:11
element class. Implements ecc group arithmetic using Jacobian coordinates See https://hyperelliptic....
Definition: element.hpp:27
static void batch_normalize(element *elements, size_t num_elements) noexcept
Definition: element_impl.hpp:870
Definition: engine.hpp:10