Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fp4.hpp
Go to the documentation of this file.
1
16#ifndef FP4_HPP_
17#define FP4_HPP_
18
21
22namespace libff {
23
24template<mp_size_t n, const bigint<n>& modulus>
25class Fp4_model;
26
27template<mp_size_t n, const bigint<n>& modulus>
28std::ostream& operator<<(std::ostream &, const Fp4_model<n, modulus> &);
29
30template<mp_size_t n, const bigint<n>& modulus>
31std::istream& operator>>(std::istream &, Fp4_model<n, modulus> &);
32
33template<mp_size_t n, const bigint<n>& modulus>
34class Fp4_model {
35public:
38 typedef my_Fp2 my_Fpe;
39
41 static my_Fp Frobenius_coeffs_c1[4]; // non_residue^((modulus^i-1)/4) for i=0,1,2,3
42
45 Fp4_model(const my_Fp2& c0, const my_Fp2& c1) : c0(c0), c1(c1) {};
46
47 void print() const { printf("c0/c1:\n"); c0.print(); c1.print(); }
48 void clear() { c0.clear(); c1.clear(); }
49
53
54 bool is_zero() const { return c0.is_zero() && c1.is_zero(); }
55 bool operator==(const Fp4_model &other) const;
56 bool operator!=(const Fp4_model &other) const;
57
58 Fp4_model operator+(const Fp4_model &other) const;
59 Fp4_model operator-(const Fp4_model &other) const;
60 Fp4_model operator*(const Fp4_model &other) const;
61 Fp4_model mul_by_023(const Fp4_model &other) const;
65 Fp4_model Frobenius_map(unsigned long power) const;
68
69 static my_Fp2 mul_by_non_residue(const my_Fp2 &elt);
70
71 template<mp_size_t m>
72 Fp4_model cyclotomic_exp(const bigint<m> &exponent) const;
73
74 static bigint<n> base_field_char() { return modulus; }
75 static constexpr size_t extension_degree() { return 4; }
76
77 friend std::ostream& operator<< <n, modulus>(std::ostream &out, const Fp4_model<n, modulus> &el);
78 friend std::istream& operator>> <n, modulus>(std::istream &in, Fp4_model<n, modulus> &el);
79};
80
81template<mp_size_t n, const bigint<n>& modulus>
83
84template<mp_size_t n, const bigint<n>& modulus>
86
87template<mp_size_t n, const bigint<n>& modulus, mp_size_t m>
89
90template<mp_size_t n, const bigint<n>& modulus, mp_size_t m, const bigint<m>& modulus_p>
92
93template<mp_size_t n, const bigint<n>& modulus>
95
96template<mp_size_t n, const bigint<n>& modulus>
98
99
100} // libff
101
102#include <libff/algebra/fields/fp4.tcc>
103
104#endif // FP4_HPP_
bool is_zero() const
Definition fp2.hpp:60
void print() const
Definition fp2.hpp:54
void clear()
Definition fp2.hpp:53
Fp4_model mul_by_023(const Fp4_model &other) const
static my_Fp2 mul_by_non_residue(const my_Fp2 &elt)
void clear()
Definition fp4.hpp:48
Fp4_model operator*(const Fp4_model &other) const
friend std::ostream & operator(std::ostream &out, const Fp4_model< n, modulus > &el)
Fp4_model inverse() const
Fp4_model cyclotomic_exp(const bigint< m > &exponent) const
Fp_model< n, modulus > my_Fp
Definition fp4.hpp:36
Fp4_model unitary_inverse() const
Fp4_model operator-(const Fp4_model &other) const
Fp4_model squared() const
my_Fp2 my_Fpe
Definition fp4.hpp:38
static my_Fp Frobenius_coeffs_c1[4]
Definition fp4.hpp:41
Fp4_model operator+(const Fp4_model &other) const
static my_Fp non_residue
Definition fp4.hpp:40
static bigint< n > base_field_char()
Definition fp4.hpp:74
bool operator!=(const Fp4_model &other) const
Fp4_model cyclotomic_squared() const
my_Fp2 c0
Definition fp4.hpp:43
Fp4_model(const my_Fp2 &c0, const my_Fp2 &c1)
Definition fp4.hpp:45
Fp4_model operator-() const
static Fp4_model< n, modulus > zero()
void print() const
Definition fp4.hpp:47
static constexpr size_t extension_degree()
Definition fp4.hpp:75
bool operator==(const Fp4_model &other) const
static Fp4_model< n, modulus > random_element()
Fp4_model Frobenius_map(unsigned long power) const
Fp2_model< n, modulus > my_Fp2
Definition fp4.hpp:37
static Fp4_model< n, modulus > one()
my_Fp2 c1
Definition fp4.hpp:43
bool is_zero() const
Definition fp4.hpp:54
bn128_GT operator^(const bn128_GT &rhs, const bigint< m > &lhs)
Definition bn128_gt.hpp:44
std::istream & operator>>(std::istream &in, alt_bn128_G1 &g)
std::ostream & operator<<(std::ostream &out, const alt_bn128_G1 &g)
alt_bn128_G1 operator*(const bigint< m > &lhs, const alt_bn128_G1 &rhs)
FieldT power(const FieldT &base, const bigint< m > &exponent)