#include <alt_bn128_g2.hpp>
Definition at line 21 of file alt_bn128_g2.hpp.
◆ base_field
◆ scalar_field
◆ twist_field
◆ alt_bn128_G2() [1/2]
libff::alt_bn128_G2::alt_bn128_G2 |
( |
| ) |
|
Definition at line 23 of file alt_bn128_g2.cpp.
24{
26 {
30 }
31}
static alt_bn128_G2 G2_zero
◆ alt_bn128_G2() [2/2]
◆ add()
Definition at line 222 of file alt_bn128_g2.cpp.
223{
224
226 {
228 }
229
231 {
232 return *this;
233 }
234
235
236
237
238
239 if (this->operator==(other))
240 {
242 }
243
244#ifdef PROFILE_OP_COUNTS
245 this->add_cnt++;
246#endif
247
248
249
266
268}
Fp2_model< alt_bn128_q_limbs, alt_bn128_modulus_q > alt_bn128_Fq2
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::alt_bn128_G2::batch_to_special_all_non_zeros |
( |
std::vector< alt_bn128_G2 > & | vec | ) |
|
|
static |
Definition at line 484 of file alt_bn128_g2.cpp.
485{
486 std::vector<alt_bn128_Fq2> Z_vec;
487 Z_vec.reserve(vec.size());
488
489 for (auto &el: vec)
490 {
491 Z_vec.emplace_back(el.Z);
492 }
494
496
497 for (size_t i = 0; i < vec.size(); ++i)
498 {
501
502 vec[i].X = vec[i].X * Z2;
503 vec[i].Y = vec[i].Y * Z3;
505 }
506}
static Fp2_model< n, modulus > one()
Fp2_model squared() const
static alt_bn128_G2 one()
void batch_invert(std::vector< FieldT > &vec)
◆ dbl()
Definition at line 339 of file alt_bn128_g2.cpp.
340{
341#ifdef PROFILE_OP_COUNTS
342 this->dbl_cnt++;
343#endif
344
346 {
347 return (*this);
348 }
349
350
351
352
362 eightC = eightC + eightC;
363 eightC = eightC + eightC;
367
369}
#define D(var, file, col, who, lev,...)
◆ is_special()
bool libff::alt_bn128_G2::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::alt_bn128_G2::is_well_formed |
( |
| ) |
const |
Definition at line 378 of file alt_bn128_g2.cpp.
379{
381 {
382 return true;
383 }
384 else
385 {
386
387
388
389
390
391
392
393
394
398
402
404 }
405}
alt_bn128_Fq2 alt_bn128_twist_coeff_b
◆ is_zero()
bool libff::alt_bn128_G2::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 270 of file alt_bn128_g2.cpp.
271{
272#ifdef DEBUG
273 assert(
other.is_special());
274#endif
275
276
278 {
280 }
281
283 {
284 return *this;
285 }
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
302
305
307
310
311 if (U1 == U2 && S1 == S2)
312 {
313
315 }
316
317#ifdef PROFILE_OP_COUNTS
318 this->add_cnt++;
319#endif
320
321
322
326 I = I + I;
333 Y3 =
r*(
V-X3) - Y3 - Y3;
335
337}
◆ mul_by_b()
Definition at line 33 of file alt_bn128_g2.cpp.
34{
36}
alt_bn128_Fq alt_bn128_twist_mul_by_b_c0
alt_bn128_Fq alt_bn128_twist_mul_by_b_c1
◆ mul_by_q()
Definition at line 371 of file alt_bn128_g2.cpp.
372{
375 (this->
Z).Frobenius_map(1));
376}
alt_bn128_Fq2 alt_bn128_twist_mul_by_q_Y
alt_bn128_Fq2 alt_bn128_twist_mul_by_q_X
◆ one()
◆ operator!=()
bool libff::alt_bn128_G2::operator!= |
( |
const alt_bn128_G2 & | other | ) |
const |
Definition at line 148 of file alt_bn128_g2.cpp.
149{
151}
bool operator==(const alt_bn128_G2 &other) const
◆ operator+()
Definition at line 153 of file alt_bn128_g2.cpp.
154{
155
157 {
159 }
160
162 {
163 return *this;
164 }
165
166
167
168
169
170
171
172
173
174
175
176
177
180
183
186
189
190 if (U1 == U2 && S1 == S2)
191 {
192
194 }
195
196
207
209}
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator==()
bool libff::alt_bn128_G2::operator== |
( |
const alt_bn128_G2 & | other | ) |
const |
Definition at line 108 of file alt_bn128_g2.cpp.
109{
111 {
112 return other.is_zero();
113 }
114
116 {
117 return false;
118 }
119
120
121
122
123
124
125
126
127
128
131
132 if ((this->
X * Z2_squared) != (
other.X * Z1_squared))
133 {
134 return false;
135 }
136
139
140 if ((this->
Y * Z2_cubed) != (
other.Y * Z1_cubed))
141 {
142 return false;
143 }
144
145 return true;
146}
◆ order()
◆ print()
void libff::alt_bn128_G2::print |
( |
| ) |
const |
Definition at line 38 of file alt_bn128_g2.cpp.
39{
41 {
43 }
44 else
45 {
47 copy.to_affine_coordinates();
48 gmp_printf("(%Nd*z + %Nd , %Nd*z + %Nd)\n",
53 }
54}
static const mp_size_t num_limbs
LOGGING_API void printf(Category category, const char *format,...)
void copy(const path &from, const path &to)
◆ print_coordinates()
void libff::alt_bn128_G2::print_coordinates |
( |
| ) |
const |
Definition at line 56 of file alt_bn128_g2.cpp.
57{
59 {
61 }
62 else
63 {
64 gmp_printf("(%Nd*z + %Nd : %Nd*z + %Nd : %Nd*z + %Nd)\n",
71 }
72}
◆ random_element()
Definition at line 417 of file alt_bn128_g2.cpp.
418{
420}
static Fp_model< n, modulus > random_element()
◆ size_in_bits()
static size_t libff::alt_bn128_G2::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::alt_bn128_G2::to_affine_coordinates |
( |
| ) |
|
Definition at line 74 of file alt_bn128_g2.cpp.
75{
77 {
81 }
82 else
83 {
87 this->
X = this->
X * Z2_inv;
88 this->
Y = this->
Y * Z3_inv;
90 }
91}
static Fp2_model< n, modulus > zero()
Fp2_model inverse() const
◆ to_special()
void libff::alt_bn128_G2::to_special |
( |
| ) |
|
◆ zero()
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const alt_bn128_G2 & | g ) |
|
friend |
Definition at line 422 of file alt_bn128_g2.cpp.
423{
425 copy.to_affine_coordinates();
427#ifdef NO_PT_COMPRESSION
429#else
430
432#endif
433
434 return out;
435}
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
alt_bn128_G2 & | g ) |
|
friend |
Definition at line 437 of file alt_bn128_g2.cpp.
438{
441
442#ifdef NO_PT_COMPRESSION
445#else
449
450 unsigned char Y_lsb;
451 in >> tX;
453 in.read((char*)&Y_lsb, 1);
454 Y_lsb -= '0';
455
456
458 {
462
463 if ((tY.c0.as_bigint().data[0] & 1) != Y_lsb)
464 {
465 tY = -tY;
466 }
467 }
468#endif
469
471 {
472 g.X = tX;
473 g.Y = tY;
475 }
476 else
477 {
479 }
480
481 return in;
482}
static alt_bn128_G2 zero()
void consume_OUTPUT_SEPARATOR(std::istream &in)
◆ fixed_base_exp_window_table
std::vector< size_t > libff::alt_bn128_G2::fixed_base_exp_window_table |
|
static |
◆ G2_one
◆ G2_zero
◆ initialized
bool libff::alt_bn128_G2::initialized = false |
|
static |
◆ wnaf_window_table
std::vector< size_t > libff::alt_bn128_G2::wnaf_window_table |
|
static |
The documentation for this class was generated from the following files: