Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
alt_bn128_g2.hpp
Go to the documentation of this file.
1
8#ifndef ALT_BN128_G2_HPP_
9#define ALT_BN128_G2_HPP_
10#include <vector>
11
14
15namespace libff {
16
17class alt_bn128_G2;
18std::ostream& operator<<(std::ostream &, const alt_bn128_G2&);
19std::istream& operator>>(std::istream &, alt_bn128_G2&);
20
22public:
23#ifdef PROFILE_OP_COUNTS
24 static long long add_cnt;
25 static long long dbl_cnt;
26#endif
27 static std::vector<size_t> wnaf_window_table;
28 static std::vector<size_t> fixed_base_exp_window_table;
31 static bool initialized;
32
36
38
39 // using Jacobian coordinates
41 alt_bn128_G2(const alt_bn128_Fq2& X, const alt_bn128_Fq2& Y, const alt_bn128_Fq2& Z) : X(X), Y(Y), Z(Z) {};
42
43 static alt_bn128_Fq2 mul_by_b(const alt_bn128_Fq2 &elt);
44
45 void print() const;
46 void print_coordinates() const;
47
49 void to_special();
50 bool is_special() const;
51
52 bool is_zero() const;
53
54 bool operator==(const alt_bn128_G2 &other) const;
55 bool operator!=(const alt_bn128_G2 &other) const;
56
57 alt_bn128_G2 operator+(const alt_bn128_G2 &other) const;
58 alt_bn128_G2 operator-() const;
59 alt_bn128_G2 operator-(const alt_bn128_G2 &other) const;
60
61 alt_bn128_G2 add(const alt_bn128_G2 &other) const;
62 alt_bn128_G2 mixed_add(const alt_bn128_G2 &other) const;
63 alt_bn128_G2 dbl() const;
64 alt_bn128_G2 mul_by_q() const;
65
66 bool is_well_formed() const;
67
68 static alt_bn128_G2 zero();
69 static alt_bn128_G2 one();
71
72 static size_t size_in_bits() { return twist_field::size_in_bits() + 1; }
75
76 friend std::ostream& operator<<(std::ostream &out, const alt_bn128_G2 &g);
77 friend std::istream& operator>>(std::istream &in, alt_bn128_G2 &g);
78
79 static void batch_to_special_all_non_zeros(std::vector<alt_bn128_G2> &vec);
80};
81
82template<mp_size_t m>
84{
85 return scalar_mul<alt_bn128_G2, m>(rhs, lhs);
86}
87
88template<mp_size_t m, const bigint<m>& modulus_p>
93
94
95} // libff
96#endif // ALT_BN128_G2_HPP_
bigint< n > as_bigint() const
bool operator!=(const alt_bn128_G2 &other) const
static alt_bn128_G2 zero()
static bigint< scalar_field::num_limbs > order()
static std::vector< size_t > wnaf_window_table
alt_bn128_G2(const alt_bn128_Fq2 &X, const alt_bn128_Fq2 &Y, const alt_bn128_Fq2 &Z)
static alt_bn128_Fq2 mul_by_b(const alt_bn128_Fq2 &elt)
alt_bn128_G2 mixed_add(const alt_bn128_G2 &other) const
friend std::istream & operator>>(std::istream &in, alt_bn128_G2 &g)
static bigint< base_field::num_limbs > base_field_char()
static alt_bn128_G2 random_element()
alt_bn128_G2 add(const alt_bn128_G2 &other) const
alt_bn128_Fq base_field
alt_bn128_G2 operator+(const alt_bn128_G2 &other) const
bool operator==(const alt_bn128_G2 &other) const
alt_bn128_G2 operator-() const
friend std::ostream & operator<<(std::ostream &out, const alt_bn128_G2 &g)
static alt_bn128_G2 one()
static alt_bn128_G2 G2_one
alt_bn128_Fq2 twist_field
static alt_bn128_G2 G2_zero
alt_bn128_Fr scalar_field
static std::vector< size_t > fixed_base_exp_window_table
bool is_well_formed() const
static size_t size_in_bits()
static bool initialized
void print_coordinates() const
static void batch_to_special_all_non_zeros(std::vector< alt_bn128_G2 > &vec)
bool is_special() const
alt_bn128_G2 dbl() const
alt_bn128_G2 mul_by_q() const
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
GroupT scalar_mul(const GroupT &base, const bigint< m > &scalar)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
alt_bn128_G1 operator*(const bigint< m > &lhs, const alt_bn128_G1 &rhs)
Definition lib.h:43