#include <alt_bn128_g1.hpp>
Definition at line 21 of file alt_bn128_g1.hpp.
◆ base_field
◆ scalar_field
◆ alt_bn128_G1() [1/2]
libff::alt_bn128_G1::alt_bn128_G1 |
( |
| ) |
|
Definition at line 23 of file alt_bn128_g1.cpp.
24{
26 {
30 }
31}
static alt_bn128_G1 G1_zero
◆ alt_bn128_G1() [2/2]
◆ add()
Definition at line 212 of file alt_bn128_g1.cpp.
213{
214
216 {
218 }
219
221 {
222 return *this;
223 }
224
225
226
227
228
229 if (this->operator==(other))
230 {
232 }
233
234#ifdef PROFILE_OP_COUNTS
235 this->add_cnt++;
236#endif
237
238
239
256
258}
Fp_model< alt_bn128_q_limbs, alt_bn128_modulus_q > alt_bn128_Fq
◆ base_field_char()
◆ batch_to_special_all_non_zeros()
void libff::alt_bn128_G1::batch_to_special_all_non_zeros |
( |
std::vector< alt_bn128_G1 > & | vec | ) |
|
|
static |
Definition at line 503 of file alt_bn128_g1.cpp.
504{
505 std::vector<alt_bn128_Fq> Z_vec;
506 Z_vec.reserve(vec.size());
507
508 for (auto &el: vec)
509 {
510 Z_vec.emplace_back(el.Z);
511 }
513
515
516 for (size_t i = 0; i < vec.size(); ++i)
517 {
520
521 vec[i].X = vec[i].X * Z2;
522 vec[i].Y = vec[i].Y * Z3;
524 }
525}
static Fp_model< n, modulus > one()
static alt_bn128_G1 one()
void batch_invert(std::vector< FieldT > &vec)
◆ dbl()
Definition at line 329 of file alt_bn128_g1.cpp.
330{
331#ifdef PROFILE_OP_COUNTS
332 this->dbl_cnt++;
333#endif
334
336 {
337 return (*this);
338 }
339
340
341
342
343
344
345
355 eightC = eightC + eightC;
356 eightC = eightC + eightC;
360
362}
#define D(var, file, col, who, lev,...)
◆ is_special()
bool libff::alt_bn128_G1::is_special |
( |
| ) |
const |
◆ is_well_formed()
bool libff::alt_bn128_G1::is_well_formed |
( |
| ) |
const |
Definition at line 364 of file alt_bn128_g1.cpp.
365{
367 {
368 return true;
369 }
370 else
371 {
372
373
374
375
376
377
378
379
380
384
388
390 }
391}
alt_bn128_Fq alt_bn128_coeff_b
◆ is_zero()
bool libff::alt_bn128_G1::is_zero |
( |
| ) |
const |
◆ mixed_add()
Definition at line 260 of file alt_bn128_g1.cpp.
261{
262#ifdef DEBUG
263 assert(
other.is_special());
264#endif
265
266
268 {
270 }
271
273 {
274 return *this;
275 }
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
292
295
297
300
301 if (U1 == U2 && S1 == S2)
302 {
303
305 }
306
307#ifdef PROFILE_OP_COUNTS
308 this->add_cnt++;
309#endif
310
311
312
316 I = I + I;
323 Y3 =
r*(
V-X3) - Y3 - Y3;
325
327}
◆ one()
◆ operator!=()
bool libff::alt_bn128_G1::operator!= |
( |
const alt_bn128_G1 & | other | ) |
const |
Definition at line 138 of file alt_bn128_g1.cpp.
139{
141}
bool operator==(const alt_bn128_G1 &other) const
◆ operator+()
Definition at line 143 of file alt_bn128_g1.cpp.
144{
145
147 {
149 }
150
152 {
153 return *this;
154 }
155
156
157
158
159
160
161
162
163
164
165
166
167
170
173
176
179
180 if (U1 == U2 && S1 == S2)
181 {
182
184 }
185
186
197
199}
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator==()
bool libff::alt_bn128_G1::operator== |
( |
const alt_bn128_G1 & | other | ) |
const |
Definition at line 98 of file alt_bn128_g1.cpp.
99{
101 {
102 return other.is_zero();
103 }
104
106 {
107 return false;
108 }
109
110
111
112
113
114
115
116
117
118
121
122 if ((this->
X * Z2_squared) != (
other.X * Z1_squared))
123 {
124 return false;
125 }
126
129
130 if ((this->
Y * Z2_cubed) != (
other.Y * Z1_cubed))
131 {
132 return false;
133 }
134
135 return true;
136}
◆ order()
◆ print()
void libff::alt_bn128_G1::print |
( |
| ) |
const |
Definition at line 33 of file alt_bn128_g1.cpp.
34{
36 {
38 }
39 else
40 {
42 copy.to_affine_coordinates();
43 gmp_printf("(%Nd , %Nd)\n",
46 }
47}
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_G1::print_coordinates |
( |
| ) |
const |
Definition at line 49 of file alt_bn128_g1.cpp.
50{
52 {
54 }
55 else
56 {
57 gmp_printf("(%Nd : %Nd : %Nd)\n",
61 }
62}
◆ random_element()
Definition at line 403 of file alt_bn128_g1.cpp.
404{
406}
static Fp_model< n, modulus > random_element()
◆ size_in_bits()
static size_t libff::alt_bn128_G1::size_in_bits |
( |
| ) |
|
|
inlinestatic |
◆ to_affine_coordinates()
void libff::alt_bn128_G1::to_affine_coordinates |
( |
| ) |
|
Definition at line 64 of file alt_bn128_g1.cpp.
65{
67 {
71 }
72 else
73 {
77 this->
X = this->
X * Z2_inv;
78 this->
Y = this->
Y * Z3_inv;
80 }
81}
static Fp_model< n, modulus > zero()
◆ to_special()
void libff::alt_bn128_G1::to_special |
( |
| ) |
|
◆ zero()
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const alt_bn128_G1 & | g ) |
|
friend |
Definition at line 408 of file alt_bn128_g1.cpp.
409{
411 copy.to_affine_coordinates();
412
414#ifdef NO_PT_COMPRESSION
416#else
417
419#endif
420
421 return out;
422}
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
alt_bn128_G1 & | g ) |
|
friend |
Definition at line 424 of file alt_bn128_g1.cpp.
425{
428
429#ifdef NO_PT_COMPRESSION
432#else
436
437 unsigned char Y_lsb;
438 in >> tX;
440 in.read((char*)&Y_lsb, 1);
441 Y_lsb -= '0';
442
443
445 {
449
450 if ((tY.as_bigint().data[0] & 1) != Y_lsb)
451 {
452 tY = -tY;
453 }
454 }
455#endif
456
458 {
459 g.X = tX;
460 g.Y = tY;
462 }
463 else
464 {
466 }
467
468 return in;
469}
static alt_bn128_G1 zero()
void consume_OUTPUT_SEPARATOR(std::istream &in)
◆ fixed_base_exp_window_table
std::vector< size_t > libff::alt_bn128_G1::fixed_base_exp_window_table |
|
static |
◆ G1_one
◆ G1_zero
◆ initialized
bool libff::alt_bn128_G1::initialized = false |
|
static |
◆ wnaf_window_table
std::vector< size_t > libff::alt_bn128_G1::wnaf_window_table |
|
static |
The documentation for this class was generated from the following files: