Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
alt_bn128_g1.hpp
Go to the documentation of this file.
1
8#ifndef ALT_BN128_G1_HPP_
9#define ALT_BN128_G1_HPP_
10#include <vector>
11
14
15namespace libff {
16
17class alt_bn128_G1;
18std::ostream& operator<<(std::ostream &, const alt_bn128_G1&);
19std::istream& operator>>(std::istream &, alt_bn128_G1&);
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
35
37
38 // using Jacobian coordinates
40 alt_bn128_G1(const alt_bn128_Fq& X, const alt_bn128_Fq& Y, const alt_bn128_Fq& Z) : X(X), Y(Y), Z(Z) {};
41
42 void print() const;
43 void print_coordinates() const;
44
46 void to_special();
47 bool is_special() const;
48
49 bool is_zero() const;
50
51 bool operator==(const alt_bn128_G1 &other) const;
52 bool operator!=(const alt_bn128_G1 &other) const;
53
54 alt_bn128_G1 operator+(const alt_bn128_G1 &other) const;
55 alt_bn128_G1 operator-() const;
56 alt_bn128_G1 operator-(const alt_bn128_G1 &other) const;
57
58 alt_bn128_G1 add(const alt_bn128_G1 &other) const;
59 alt_bn128_G1 mixed_add(const alt_bn128_G1 &other) const;
60 alt_bn128_G1 dbl() const;
61
62 bool is_well_formed() const;
63
64 static alt_bn128_G1 zero();
65 static alt_bn128_G1 one();
67
68 static size_t size_in_bits() { return base_field::size_in_bits() + 1; }
71
72 friend std::ostream& operator<<(std::ostream &out, const alt_bn128_G1 &g);
73 friend std::istream& operator>>(std::istream &in, alt_bn128_G1 &g);
74
75 static void batch_to_special_all_non_zeros(std::vector<alt_bn128_G1> &vec);
76};
77
78template<mp_size_t m>
80{
81 return scalar_mul<alt_bn128_G1, m>(rhs, lhs);
82}
83
84template<mp_size_t m, const bigint<m>& modulus_p>
89
90std::ostream& operator<<(std::ostream& out, const std::vector<alt_bn128_G1> &v);
91std::istream& operator>>(std::istream& in, std::vector<alt_bn128_G1> &v);
92
93} // libff
94#endif // ALT_BN128_G1_HPP_
bigint< n > as_bigint() const
static bool initialized
alt_bn128_Fq base_field
static std::vector< size_t > wnaf_window_table
bool operator!=(const alt_bn128_G1 &other) const
static std::vector< size_t > fixed_base_exp_window_table
static alt_bn128_G1 zero()
static alt_bn128_G1 G1_one
bool is_well_formed() const
alt_bn128_G1 dbl() const
static alt_bn128_G1 one()
bool operator==(const alt_bn128_G1 &other) const
static void batch_to_special_all_non_zeros(std::vector< alt_bn128_G1 > &vec)
void print_coordinates() const
alt_bn128_Fr scalar_field
static alt_bn128_G1 G1_zero
alt_bn128_G1 mixed_add(const alt_bn128_G1 &other) const
friend std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
alt_bn128_G1 operator-() const
static size_t size_in_bits()
alt_bn128_G1 add(const alt_bn128_G1 &other) const
bool is_special() const
alt_bn128_G1 operator+(const alt_bn128_G1 &other) const
friend std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
static bigint< base_field::num_limbs > base_field_char()
alt_bn128_G1(const alt_bn128_Fq &X, const alt_bn128_Fq &Y, const alt_bn128_Fq &Z)
static alt_bn128_G1 random_element()
static bigint< scalar_field::num_limbs > order()
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