Clearmatics Libff  0.1
C++ library for Finite Fields and Elliptic Curves
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
libff::Fp3_model< n, modulus > Class Template Reference

#include <fp3.hpp>

Collaboration diagram for libff::Fp3_model< n, modulus >:
Collaboration graph
[legend]

Public Types

typedef Fp_model< n, modulus > my_Fp
 

Public Member Functions

 Fp3_model ()
 
 Fp3_model (const my_Fp &c0, const my_Fp &c1, const my_Fp &c2)
 
void clear ()
 
void print () const
 
bool is_zero () const
 
bool operator== (const Fp3_model &other) const
 
bool operator!= (const Fp3_model &other) const
 
Fp3_model operator+ (const Fp3_model &other) const
 
Fp3_model operator- (const Fp3_model &other) const
 
Fp3_model operator* (const Fp3_model &other) const
 
Fp3_model operator- () const
 
Fp3_model squared () const
 
Fp3_model inverse () const
 
Fp3_model Frobenius_map (unsigned long power) const
 
Fp3_model sqrt () const
 HAS TO BE A SQUARE (else does not terminate) More...
 
template<mp_size_t m>
Fp3_model operator^ (const bigint< m > &other) const
 

Static Public Member Functions

static Fp3_model< n, modulus > zero ()
 
static Fp3_model< n, modulus > one ()
 
static Fp3_model< n, modulus > random_element ()
 
static size_t size_in_bits ()
 
static bigint< n > base_field_char ()
 
static constexpr size_t extension_degree ()
 

Public Attributes

my_Fp coeffs [3]
 

Static Public Attributes

static const size_t tower_extension_degree = 3
 
static bigint< 3 *n > euler
 (modulus^3-1)/2 More...
 
static size_t s
 modulus^3 = 2^s * t + 1 More...
 
static bigint< 3 *n > t
 with t odd More...
 
static bigint< 3 *n > t_minus_1_over_2
 (t-1)/2 More...
 
static my_Fp non_residue
 
static Fp3_model< n, modulus > nqr
 a quadratic nonresidue in Fp3 More...
 
static Fp3_model< n, modulus > nqr_to_t
 nqr^t More...
 
static my_Fp Frobenius_coeffs_c1 [3]
 non_residue^((modulus^i-1)/3) for i=0,1,2 More...
 
static my_Fp Frobenius_coeffs_c2 [3]
 non_residue^((2*modulus^i-2)/3) for i=0,1,2 More...
 

Friends

std::ostream & operator (std::ostream &out, const Fp3_model< n, modulus > &el)
 
std::istream & operator>> (std::istream &in, Fp3_model< n, modulus > &el)
 

Detailed Description

template<mp_size_t n, const bigint< n > & modulus>
class libff::Fp3_model< n, modulus >

Arithmetic in the field F[p^3].

Let p := modulus. This interface provides arithmetic for the extension field Fp3 = Fp[U]/(U^3-non_residue), where non_residue is in Fp.

ASSUMPTION: p = 1 (mod 6)

Definition at line 18 of file fp3.hpp.

Member Typedef Documentation

◆ my_Fp

template<mp_size_t n, const bigint< n > & modulus>
typedef Fp_model<n, modulus> libff::Fp3_model< n, modulus >::my_Fp

Definition at line 35 of file fp3.hpp.

Constructor & Destructor Documentation

◆ Fp3_model() [1/2]

template<mp_size_t n, const bigint< n > & modulus>
libff::Fp3_model< n, modulus >::Fp3_model ( )
inline

Definition at line 60 of file fp3.hpp.

60 {};

◆ Fp3_model() [2/2]

template<mp_size_t n, const bigint< n > & modulus>
libff::Fp3_model< n, modulus >::Fp3_model ( const my_Fp c0,
const my_Fp c1,
const my_Fp c2 
)
inline

Definition at line 63 of file fp3.hpp.

64  {
65  this->coeffs[0] = c0;
66  this->coeffs[1] = c1;
67  this->coeffs[2] = c2;
68  return;
69  };

Member Function Documentation

◆ base_field_char()

template<mp_size_t n, const bigint< n > & modulus>
static bigint<n> libff::Fp3_model< n, modulus >::base_field_char ( )
inlinestatic

Definition at line 110 of file fp3.hpp.

110 { return modulus; }

◆ clear()

template<mp_size_t n, const bigint< n > & modulus>
void libff::Fp3_model< n, modulus >::clear ( )
inline

Definition at line 71 of file fp3.hpp.

72  {
73  coeffs[0].clear();
74  coeffs[1].clear();
75  coeffs[2].clear();
76  }
Here is the caller graph for this function:

◆ extension_degree()

template<mp_size_t n, const bigint< n > & modulus>
static constexpr size_t libff::Fp3_model< n, modulus >::extension_degree ( )
inlinestaticconstexpr

Definition at line 111 of file fp3.hpp.

111 { return 3; }

◆ Frobenius_map()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::Frobenius_map ( unsigned long  power) const

◆ inverse()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::inverse ( ) const
Here is the caller graph for this function:

◆ is_zero()

template<mp_size_t n, const bigint< n > & modulus>
bool libff::Fp3_model< n, modulus >::is_zero ( ) const
inline

Definition at line 89 of file fp3.hpp.

90  {
91  return coeffs[0].is_zero() && coeffs[1].is_zero() &&
92  coeffs[2].is_zero();
93  }
Here is the caller graph for this function:

◆ one()

template<mp_size_t n, const bigint< n > & modulus>
static Fp3_model<n, modulus> libff::Fp3_model< n, modulus >::one ( )
static

◆ operator!=()

template<mp_size_t n, const bigint< n > & modulus>
bool libff::Fp3_model< n, modulus >::operator!= ( const Fp3_model< n, modulus > &  other) const

◆ operator*()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::operator* ( const Fp3_model< n, modulus > &  other) const

◆ operator+()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::operator+ ( const Fp3_model< n, modulus > &  other) const

◆ operator-() [1/2]

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::operator- ( ) const

◆ operator-() [2/2]

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::operator- ( const Fp3_model< n, modulus > &  other) const

◆ operator==()

template<mp_size_t n, const bigint< n > & modulus>
bool libff::Fp3_model< n, modulus >::operator== ( const Fp3_model< n, modulus > &  other) const

◆ operator^()

template<mp_size_t n, const bigint< n > & modulus>
template<mp_size_t m>
Fp3_model libff::Fp3_model< n, modulus >::operator^ ( const bigint< m > &  other) const

◆ print()

template<mp_size_t n, const bigint< n > & modulus>
void libff::Fp3_model< n, modulus >::print ( ) const
inline

Definition at line 77 of file fp3.hpp.

78  {
79  printf("c0/c1/c2:\n");
80  coeffs[0].print();
81  coeffs[1].print();
82  coeffs[2].print();
83  }
Here is the caller graph for this function:

◆ random_element()

template<mp_size_t n, const bigint< n > & modulus>
static Fp3_model<n, modulus> libff::Fp3_model< n, modulus >::random_element ( )
static

◆ size_in_bits()

template<mp_size_t n, const bigint< n > & modulus>
static size_t libff::Fp3_model< n, modulus >::size_in_bits ( )
inlinestatic

Definition at line 109 of file fp3.hpp.

109 { return 3 * my_Fp::size_in_bits(); }

◆ sqrt()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::sqrt ( ) const

HAS TO BE A SQUARE (else does not terminate)

Here is the caller graph for this function:

◆ squared()

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model libff::Fp3_model< n, modulus >::squared ( ) const
Here is the caller graph for this function:

◆ zero()

template<mp_size_t n, const bigint< n > & modulus>
static Fp3_model<n, modulus> libff::Fp3_model< n, modulus >::zero ( )
static

Friends And Related Function Documentation

◆ operator

template<mp_size_t n, const bigint< n > & modulus>
std::ostream& operator ( std::ostream &  out,
const Fp3_model< n, modulus > &  el 
)
friend

◆ operator>>

template<mp_size_t n, const bigint< n > & modulus>
std::istream& operator>> ( std::istream &  in,
Fp3_model< n, modulus > &  el 
)
friend

Member Data Documentation

◆ coeffs

template<mp_size_t n, const bigint< n > & modulus>
my_Fp libff::Fp3_model< n, modulus >::coeffs[3]

Definition at line 59 of file fp3.hpp.

◆ euler

template<mp_size_t n, const bigint< n > & modulus>
bigint< 3 *n > libff::Fp3_model< n, modulus >::euler
static

(modulus^3-1)/2

Definition at line 40 of file fp3.hpp.

◆ Frobenius_coeffs_c1

template<mp_size_t n, const bigint< n > & modulus>
Fp_model< n, modulus > libff::Fp3_model< n, modulus >::Frobenius_coeffs_c1
static

non_residue^((modulus^i-1)/3) for i=0,1,2

Definition at line 55 of file fp3.hpp.

◆ Frobenius_coeffs_c2

template<mp_size_t n, const bigint< n > & modulus>
Fp_model< n, modulus > libff::Fp3_model< n, modulus >::Frobenius_coeffs_c2
static

non_residue^((2*modulus^i-2)/3) for i=0,1,2

Definition at line 57 of file fp3.hpp.

◆ non_residue

template<mp_size_t n, const bigint< n > & modulus>
Fp_model< n, modulus > libff::Fp3_model< n, modulus >::non_residue
static

X^6-non_residue irreducible over Fp; used for constructing aFp3 = Fp[X] / (X^3 - non_residue)

Definition at line 49 of file fp3.hpp.

◆ nqr

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model< n, modulus > libff::Fp3_model< n, modulus >::nqr
static

a quadratic nonresidue in Fp3

Definition at line 51 of file fp3.hpp.

◆ nqr_to_t

template<mp_size_t n, const bigint< n > & modulus>
Fp3_model< n, modulus > libff::Fp3_model< n, modulus >::nqr_to_t
static

nqr^t

Definition at line 53 of file fp3.hpp.

◆ s

template<mp_size_t n, const bigint< n > & modulus>
size_t libff::Fp3_model< n, modulus >::s
static

modulus^3 = 2^s * t + 1

Definition at line 42 of file fp3.hpp.

◆ t

template<mp_size_t n, const bigint< n > & modulus>
bigint< 3 *n > libff::Fp3_model< n, modulus >::t
static

with t odd

Definition at line 44 of file fp3.hpp.

◆ t_minus_1_over_2

template<mp_size_t n, const bigint< n > & modulus>
bigint< 3 *n > libff::Fp3_model< n, modulus >::t_minus_1_over_2
static

(t-1)/2

Definition at line 46 of file fp3.hpp.

◆ tower_extension_degree

template<mp_size_t n, const bigint< n > & modulus>
const size_t libff::Fp3_model< n, modulus >::tower_extension_degree = 3
static

Definition at line 37 of file fp3.hpp.


The documentation for this class was generated from the following file:
libff::Fp_model::print
void print() const
libff::Fp_model::is_zero
bool is_zero() const
libff::Fp_model::clear
void clear()
libff::Fp3_model::coeffs
my_Fp coeffs[3]
Definition: fp3.hpp:59
libff::Fp_model::size_in_bits
static size_t size_in_bits()
Definition: fp.hpp:134