12#ifdef PROFILE_OP_COUNTS
13long long edwards_G2::add_cnt = 0;
14long long edwards_G2::dbl_cnt = 0;
56 copy.to_affine_coordinates();
57 gmp_printf(
"(%Nd*z^2 + %Nd*z + %Nd , %Nd*z^2 + %Nd*z + %Nd)\n",
75 gmp_printf(
"(%Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd : %Nd*z^2 + %Nd*z + %Nd)\n",
104 this->
X = tX * tZ_inv;
105 this->Y = tY * tZ_inv;
122 this->
X = this->
X * Z_inv;
123 this->
Y = this->
Y * Z_inv;
127 assert((*
this) == copy);
138 return (this->
Y.
is_zero() && this->Z.is_zero());
156 if ((this->
X * other.Z) != (other.X * this->Z))
162 if ((this->
Y * other.
Z) != (other.Y * this->Z))
188 return this->
add(other);
199 return (*
this) + (-other);
204#ifdef PROFILE_OP_COUNTS
226#ifdef PROFILE_OP_COUNTS
241 assert(other.is_special());
263#ifdef PROFILE_OP_COUNTS
320 return (Z2 * (aY2 + X2 - dZ2) == X2 * Y2);
342 copy.to_affine_coordinates();
343#ifdef NO_PT_COMPRESSION
356#ifdef NO_PT_COMPRESSION
369 in.read((
char*)&Y_lsb, 1);
389#ifdef USE_MIXED_ADDITION
398 std::vector<edwards_Fq3> Z_vec;
399 Z_vec.reserve(vec.size());
403 Z_vec.emplace_back(el.Z);
409 for (
size_t i = 0; i < vec.size(); ++i)
411 vec[i].X = vec[i].X * Z_vec[i];
412 vec[i].Y = vec[i].Y * Z_vec[i];
Fp3_model inverse() const
Fp3_model squared() const
static Fp3_model< n, modulus > one()
static Fp3_model< n, modulus > zero()
static const mp_size_t num_limbs
bigint< n > as_bigint() const
static Fp_model< n, modulus > random_element()
static edwards_G2 random_element()
bool is_well_formed() const
bool operator!=(const edwards_G2 &other) const
bool operator==(const edwards_G2 &other) const
static void batch_to_special_all_non_zeros(std::vector< edwards_G2 > &vec)
edwards_G2 add(const edwards_G2 &other) const
edwards_G2 operator-() const
static std::vector< size_t > fixed_base_exp_window_table
edwards_G2 mixed_add(const edwards_G2 &other) const
static edwards_Fq3 mul_by_a(const edwards_Fq3 &elt)
void to_affine_coordinates()
void print_coordinates() const
static edwards_Fq3 mul_by_d(const edwards_Fq3 &elt)
edwards_G2 operator+(const edwards_G2 &other) const
static std::vector< size_t > wnaf_window_table
static edwards_G2 G2_zero
edwards_G2 mul_by_q() const
#define D(var, file, col, who, lev,...)
Fp3_model< edwards_q_limbs, edwards_modulus_q > edwards_Fq3
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
edwards_Fq edwards_twist_mul_by_q_Y
void consume_OUTPUT_SEPARATOR(std::istream &in)
edwards_Fq edwards_twist_mul_by_d_c1
edwards_Fq edwards_twist_mul_by_q_Z
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
edwards_Fq edwards_twist_mul_by_a_c0
edwards_Fq edwards_twist_mul_by_d_c2
void batch_invert(std::vector< FieldT > &vec)
edwards_Fq edwards_twist_mul_by_d_c0