12#ifdef PROFILE_OP_COUNTS
13long long alt_bn128_G2::add_cnt = 0;
14long long alt_bn128_G2::dbl_cnt = 0;
47 copy.to_affine_coordinates();
48 gmp_printf(
"(%Nd*z + %Nd , %Nd*z + %Nd)\n",
64 gmp_printf(
"(%Nd*z + %Nd : %Nd*z + %Nd : %Nd*z + %Nd)\n",
87 this->
X = this->
X * Z2_inv;
88 this->
Y = this->
Y * Z3_inv;
132 if ((this->
X * Z2_squared) != (other.X * Z1_squared))
140 if ((this->
Y * Z2_cubed) != (other.Y * Z1_cubed))
190 if (U1 == U2 && S1 == S2)
219 return (*
this) + (-other);
239 if (this->
operator==(other))
244#ifdef PROFILE_OP_COUNTS
273 assert(other.is_special());
311 if (U1 == U2 && S1 == S2)
317#ifdef PROFILE_OP_COUNTS
333 Y3 =
r*(
V-X3) - Y3 - Y3;
341#ifdef PROFILE_OP_COUNTS
362 eightC = eightC + eightC;
363 eightC = eightC + eightC;
375 (this->
Z).Frobenius_map(1));
425 copy.to_affine_coordinates();
427#ifdef NO_PT_COMPRESSION
442#ifdef NO_PT_COMPRESSION
443 in >> is_zero >> tX >> tY;
446 in.read((
char*)&is_zero, 1);
453 in.read((
char*)&Y_lsb, 1);
486 std::vector<alt_bn128_Fq2> Z_vec;
487 Z_vec.reserve(vec.size());
491 Z_vec.emplace_back(el.Z);
497 for (
size_t i = 0; i < vec.size(); ++i)
502 vec[i].X = vec[i].X * Z2;
503 vec[i].Y = vec[i].Y * Z3;
static Fp2_model< n, modulus > zero()
Fp2_model inverse() const
static Fp2_model< n, modulus > one()
Fp2_model squared() const
static const mp_size_t num_limbs
bigint< n > as_bigint() const
static Fp_model< n, modulus > random_element()
bool operator!=(const alt_bn128_G2 &other) const
static alt_bn128_G2 zero()
static std::vector< size_t > wnaf_window_table
static alt_bn128_Fq2 mul_by_b(const alt_bn128_Fq2 &elt)
alt_bn128_G2 mixed_add(const alt_bn128_G2 &other) const
void to_affine_coordinates()
static alt_bn128_G2 random_element()
alt_bn128_G2 add(const alt_bn128_G2 &other) const
alt_bn128_G2 operator+(const alt_bn128_G2 &other) const
bool operator==(const alt_bn128_G2 &other) const
alt_bn128_G2 operator-() const
static alt_bn128_G2 one()
static alt_bn128_G2 G2_one
static alt_bn128_G2 G2_zero
static std::vector< size_t > fixed_base_exp_window_table
bool is_well_formed() const
void print_coordinates() const
static void batch_to_special_all_non_zeros(std::vector< alt_bn128_G2 > &vec)
alt_bn128_G2 mul_by_q() const
#define D(var, file, col, who, lev,...)
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
void consume_OUTPUT_SEPARATOR(std::istream &in)
Fp2_model< alt_bn128_q_limbs, alt_bn128_modulus_q > alt_bn128_Fq2
alt_bn128_Fq alt_bn128_twist_mul_by_b_c0
alt_bn128_Fq2 alt_bn128_twist_mul_by_q_Y
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
alt_bn128_Fq2 alt_bn128_twist_coeff_b
alt_bn128_Fq alt_bn128_twist_mul_by_b_c1
void batch_invert(std::vector< FieldT > &vec)
alt_bn128_Fq2 alt_bn128_twist_mul_by_q_X