mpyc.finfields
index
github.com/lschoe/mpyc/blob/v0.10/mpyc/finfields.py

This module supports finite (Galois) fields.
 
Function GF creates types implementing finite fields.
Instantiate an object from a field and subsequently apply overloaded
operators such as +,-,*,/ etc., to compute with field elements.
In-place versions of the field operators are also provided.
Taking square roots and quadratic residuosity tests supported as well.
 
Moreover, (multidimensional) arrays over finite fields are available
with operators like +,-,*,/ for convenient and efficient NumPy-based
vectorized processing next to operator @ for matrix multiplication.
Much of the NumPy API can be used to manipulate these arrays as well.

 
Modules
       
functools
mpyc.gfpx
mpyc.gmpy
mpyc.numpy
os

 
Classes
       
builtins.object
FiniteFieldArray
ExtensionFieldArray
BinaryFieldArray
PrimeFieldArray
FiniteFieldElement
ExtensionFieldElement
BinaryFieldElement
PrimeFieldElement

 
class BinaryFieldArray(ExtensionFieldArray)
    BinaryFieldArray(value, check=True, copy=False)
 

 
 
Method resolution order:
BinaryFieldArray
ExtensionFieldArray
FiniteFieldArray
builtins.object

Data and other attributes defined here:
__annotations__ = {}

Methods inherited from ExtensionFieldArray:
__repr__(self)
Return repr(self).

Data descriptors inherited from ExtensionFieldArray:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Methods inherited from FiniteFieldArray:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
__contains__(self, value)
__eq__(self, other)
Elementwise equality as for Numpy arrays.
__getitem__(self, key)
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imatmul__(self, other)
In-place matrix multiplication.
__imul__(self, other)
In-place multiplication.
__init__(self, value, check=True, copy=False)
Initialize self.  See help(type(self)) for accurate signature.
__ipow__(self, other)
In-place exponentiation.
__irshift__(self, other)
In-place right shift.
__isub__(self, other)
In-place subtraction.
__iter__(self)
__itruediv__(self, other)
"In-place division.
__len__(self)
__lshift__(self, other)
Left shift.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Elementwise nonequality as for Numpy arrays.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation.
__radd__ = __add__(self, other)
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__setitem__(self, key, value)
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
compress(self, *args, **kwargs)
copy(self, *args, **kwargs)
diagonal(self, *args, **kwargs)
flatten(self, *args, **kwargs)
is_sqr(self)
Test for quadratic residuosity (0 is also square).
nonzero(self, *args, **kwargs)
prod(self, *args, **kwargs)
ravel(self, *args, **kwargs)
reciprocal(self)
Multiplicative inverse.
repeat(self, *args, **kwargs)
reshape(self, *args, **kwargs)
sqrt(self, INV=False)
Modular (inverse) square root.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
take(self, *args, **kwargs)
tolist(self)
trace(self, *args, **kwargs)
transpose(self, *axes)

Static methods inherited from FiniteFieldArray:
diag(a, k=0)
gauss_det(a)
Determinant by Gaussian elimination on (last 2 dimensions of) array a.
gauss_inv(A)
Inverse by Gaussian elimination on augmented matrix (A | I).
gauss_solve(A, B)
Linear solve by Gaussian elimination on matrix (A | B).
matrix_pow(A, n)

Readonly properties inherited from FiniteFieldArray:
T
flat
ndim
shape
size

Data descriptors inherited from FiniteFieldArray:
value

Data and other attributes inherited from FiniteFieldArray:
__hash__ = None

 
class BinaryFieldElement(ExtensionFieldElement)
    BinaryFieldElement(value)
 
Common base class for binary field elements.
 
 
Method resolution order:
BinaryFieldElement
ExtensionFieldElement
FiniteFieldElement
builtins.object

Data and other attributes defined here:
__annotations__ = {'modulus': <class 'mpyc.gfpx.BinaryPolynomial'>}
characteristic = 2

Methods inherited from ExtensionFieldElement:
__init__(self, value)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
Extract field element as an integer value.
__irshift__(self, other)
In-place right shift.
__pow__(self, other)
Exponentiation.
__reduce__(self)
Helper for pickle.
__repr__(self)
Return repr(self).
__rshift__(self, other)
Right shift.

Static methods inherited from ExtensionFieldElement:
createGF(modulus)
Create new object for use by pickle module.

Methods inherited from FiniteFieldElement:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__bool__(self)
Truth value testing.
 
Return False if this field element is zero, True otherwise.
Field elements can thus be used directly in Boolean formulas.
__eq__(self, other)
Equality test.
__hash__(self)
Make finite field elements hashable (e.g., for LRU caching).
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imul__(self, other)
In-place multiplication.
__isub__(self, other)
In-place subtraction.
__itruediv__(self, other)
In-place division.
__lshift__(self, other)
Left shift.
__mul__(self, other)
Multiplication.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__radd__(self, other)
Addition (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmul__(self, other)
Multiplication (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
is_sqr(self)
Test for quadratic residuosity (0 is also square).
reciprocal(self)
Multiplicative inverse.
sqrt(self, INV=False)
Modular (inverse) square root.

Class methods inherited from FiniteFieldElement:
from_bytes(data) from builtins.type
Return the list of integers represented by the given byte string.
to_bytes(x) from builtins.type
Return byte string representing the given list/ndarray of integers x.

Data descriptors inherited from FiniteFieldElement:
value

Data and other attributes inherited from FiniteFieldElement:
byte_length = None
ext_deg = None
is_signed = None
order = None

 
class ExtensionFieldArray(FiniteFieldArray)
    ExtensionFieldArray(value, check=True, copy=False)
 

 
 
Method resolution order:
ExtensionFieldArray
FiniteFieldArray
builtins.object

Methods defined here:
__repr__(self)
Return repr(self).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__annotations__ = {}

Methods inherited from FiniteFieldArray:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
__contains__(self, value)
__eq__(self, other)
Elementwise equality as for Numpy arrays.
__getitem__(self, key)
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imatmul__(self, other)
In-place matrix multiplication.
__imul__(self, other)
In-place multiplication.
__init__(self, value, check=True, copy=False)
Initialize self.  See help(type(self)) for accurate signature.
__ipow__(self, other)
In-place exponentiation.
__irshift__(self, other)
In-place right shift.
__isub__(self, other)
In-place subtraction.
__iter__(self)
__itruediv__(self, other)
"In-place division.
__len__(self)
__lshift__(self, other)
Left shift.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Elementwise nonequality as for Numpy arrays.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation.
__radd__ = __add__(self, other)
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__setitem__(self, key, value)
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
compress(self, *args, **kwargs)
copy(self, *args, **kwargs)
diagonal(self, *args, **kwargs)
flatten(self, *args, **kwargs)
is_sqr(self)
Test for quadratic residuosity (0 is also square).
nonzero(self, *args, **kwargs)
prod(self, *args, **kwargs)
ravel(self, *args, **kwargs)
reciprocal(self)
Multiplicative inverse.
repeat(self, *args, **kwargs)
reshape(self, *args, **kwargs)
sqrt(self, INV=False)
Modular (inverse) square root.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
take(self, *args, **kwargs)
tolist(self)
trace(self, *args, **kwargs)
transpose(self, *axes)

Static methods inherited from FiniteFieldArray:
diag(a, k=0)
gauss_det(a)
Determinant by Gaussian elimination on (last 2 dimensions of) array a.
gauss_inv(A)
Inverse by Gaussian elimination on augmented matrix (A | I).
gauss_solve(A, B)
Linear solve by Gaussian elimination on matrix (A | B).
matrix_pow(A, n)

Readonly properties inherited from FiniteFieldArray:
T
flat
ndim
shape
size

Data descriptors inherited from FiniteFieldArray:
value

Data and other attributes inherited from FiniteFieldArray:
__hash__ = None

 
class ExtensionFieldElement(FiniteFieldElement)
    ExtensionFieldElement(value)
 
Common base class for extension field elements.
 
 
Method resolution order:
ExtensionFieldElement
FiniteFieldElement
builtins.object

Methods defined here:
__init__(self, value)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
Extract field element as an integer value.
__irshift__(self, other)
In-place right shift.
__pow__(self, other)
Exponentiation.
__reduce__(self)
Helper for pickle.
__repr__(self)
Return repr(self).
__rshift__(self, other)
Right shift.

Static methods defined here:
createGF(modulus)
Create new object for use by pickle module.

Data and other attributes defined here:
__annotations__ = {'modulus': <class 'mpyc.gfpx.Polynomial'>}

Methods inherited from FiniteFieldElement:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__bool__(self)
Truth value testing.
 
Return False if this field element is zero, True otherwise.
Field elements can thus be used directly in Boolean formulas.
__eq__(self, other)
Equality test.
__hash__(self)
Make finite field elements hashable (e.g., for LRU caching).
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imul__(self, other)
In-place multiplication.
__isub__(self, other)
In-place subtraction.
__itruediv__(self, other)
In-place division.
__lshift__(self, other)
Left shift.
__mul__(self, other)
Multiplication.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__radd__(self, other)
Addition (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmul__(self, other)
Multiplication (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
is_sqr(self)
Test for quadratic residuosity (0 is also square).
reciprocal(self)
Multiplicative inverse.
sqrt(self, INV=False)
Modular (inverse) square root.

Class methods inherited from FiniteFieldElement:
from_bytes(data) from builtins.type
Return the list of integers represented by the given byte string.
to_bytes(x) from builtins.type
Return byte string representing the given list/ndarray of integers x.

Data descriptors inherited from FiniteFieldElement:
value

Data and other attributes inherited from FiniteFieldElement:
byte_length = None
characteristic = None
ext_deg = None
is_signed = None
order = None

 
class FiniteFieldArray(builtins.object)
    FiniteFieldArray(value, check=True, copy=False)
 
Common base class for finite field arrays.
 
An array over finite field F behaves much like a NumPy array with dtype=F.
Conceptually, an array a over F can be thought of as, for example
 
   "a = np.array([[F(1), F(2)], [F(0), F(3)]], dtype=F)"
 
Internally, however, arrays over a finite field F are represented by NumPy
arrays with dtype=object storing just the values of the finite field elements:
 
   "a = (field=F, value=np.array([[1, 2], [0, 3]], dtype=object))"
 
Invariant: elements of array 'value' are reduced w.r.t. modulus.
 
  Methods defined here:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
__contains__(self, value)
__eq__(self, other)
Elementwise equality as for Numpy arrays.
__getitem__(self, key)
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imatmul__(self, other)
In-place matrix multiplication.
__imul__(self, other)
In-place multiplication.
__init__(self, value, check=True, copy=False)
Initialize self.  See help(type(self)) for accurate signature.
__ipow__(self, other)
In-place exponentiation.
__irshift__(self, other)
In-place right shift.
__isub__(self, other)
In-place subtraction.
__iter__(self)
__itruediv__(self, other)
"In-place division.
__len__(self)
__lshift__(self, other)
Left shift.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Elementwise nonequality as for Numpy arrays.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation.
__radd__ = __add__(self, other)
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__setitem__(self, key, value)
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
compress(self, *args, **kwargs)
copy(self, *args, **kwargs)
diagonal(self, *args, **kwargs)
flatten(self, *args, **kwargs)
is_sqr(self)
Test for quadratic residuosity (0 is also square).
nonzero(self, *args, **kwargs)
prod(self, *args, **kwargs)
ravel(self, *args, **kwargs)
reciprocal(self)
Multiplicative inverse.
repeat(self, *args, **kwargs)
reshape(self, *args, **kwargs)
sqrt(self, INV=False)
Modular (inverse) square root.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
take(self, *args, **kwargs)
tolist(self)
trace(self, *args, **kwargs)
transpose(self, *axes)

Static methods defined here:
diag(a, k=0)
gauss_det(a)
Determinant by Gaussian elimination on (last 2 dimensions of) array a.
gauss_inv(A)
Inverse by Gaussian elimination on augmented matrix (A | I).
gauss_solve(A, B)
Linear solve by Gaussian elimination on matrix (A | B).
matrix_pow(A, n)

Readonly properties defined here:
T
flat
ndim
shape
size

Data descriptors defined here:
value

Data and other attributes defined here:
__annotations__ = {'_mix_types': <class 'type'>, 'field': <class 'type'>}
__hash__ = None

 
class FiniteFieldElement(builtins.object)
    FiniteFieldElement(value)
 
Abstract base class for finite field elements.
 
Invariant: 'value' is reduced w.r.t. modulus.
 
  Methods defined here:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__bool__(self)
Truth value testing.
 
Return False if this field element is zero, True otherwise.
Field elements can thus be used directly in Boolean formulas.
__eq__(self, other)
Equality test.
__hash__(self)
Make finite field elements hashable (e.g., for LRU caching).
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imul__(self, other)
In-place multiplication.
__init__(self, value)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
Extract field element as an integer value.
__irshift__(self, other)
In-place right shift.
__isub__(self, other)
In-place subtraction.
__itruediv__(self, other)
In-place division.
__lshift__(self, other)
Left shift.
__mul__(self, other)
Multiplication.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation.
__radd__(self, other)
Addition (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmul__(self, other)
Multiplication (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
is_sqr(self)
Test for quadratic residuosity (0 is also square).
reciprocal(self)
Multiplicative inverse.
sqrt(self, INV=False)
Modular (inverse) square root.

Class methods defined here:
from_bytes(data) from builtins.type
Return the list of integers represented by the given byte string.
to_bytes(x) from builtins.type
Return byte string representing the given list/ndarray of integers x.

Data descriptors defined here:
value

Data and other attributes defined here:
__annotations__ = {'_mix_types': <class 'type'>, 'array': <class 'type'>, 'modulus': <class 'type'>}
byte_length = None
characteristic = None
ext_deg = None
is_signed = None
order = None

 
class PrimeFieldArray(FiniteFieldArray)
    PrimeFieldArray(value, check=True, copy=False)
 

 
 
Method resolution order:
PrimeFieldArray
FiniteFieldArray
builtins.object

Methods defined here:
__abs__(self)
Absolute value of (signed) value.
__int__(self)
Extract (signed) integer value for size-1 arrays only.
__repr__(self)
Return repr(self).
signed_(self)
Return signed integer representation, symmetric around zero.
unsigned_(self)
Return unsigned integer representation.

Class methods defined here:
intarray(a) from builtins.type
Extract finite field array as a (signed) integer array.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
__annotations__ = {}

Methods inherited from FiniteFieldArray:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__array_ufunc__(self, ufunc, method, *inputs, **kwargs)
__contains__(self, value)
__eq__(self, other)
Elementwise equality as for Numpy arrays.
__getitem__(self, key)
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imatmul__(self, other)
In-place matrix multiplication.
__imul__(self, other)
In-place multiplication.
__init__(self, value, check=True, copy=False)
Initialize self.  See help(type(self)) for accurate signature.
__ipow__(self, other)
In-place exponentiation.
__irshift__(self, other)
In-place right shift.
__isub__(self, other)
In-place subtraction.
__iter__(self)
__itruediv__(self, other)
"In-place division.
__len__(self)
__lshift__(self, other)
Left shift.
__matmul__(self, other)
Matrix multiplication.
__mul__(self, other)
Multiplication.
__ne__(self, other)
Elementwise nonequality as for Numpy arrays.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__pow__(self, other)
Exponentiation.
__radd__ = __add__(self, other)
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmatmul__(self, other)
Matrix multiplication (with reflected arguments).
__rmul__ = __mul__(self, other)
__rpow__(self, other)
Exponentiation (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rshift__(self, other)
Right shift.
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__setitem__(self, key, value)
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
compress(self, *args, **kwargs)
copy(self, *args, **kwargs)
diagonal(self, *args, **kwargs)
flatten(self, *args, **kwargs)
is_sqr(self)
Test for quadratic residuosity (0 is also square).
nonzero(self, *args, **kwargs)
prod(self, *args, **kwargs)
ravel(self, *args, **kwargs)
reciprocal(self)
Multiplicative inverse.
repeat(self, *args, **kwargs)
reshape(self, *args, **kwargs)
sqrt(self, INV=False)
Modular (inverse) square root.
sum(self, *args, **kwargs)
swapaxes(self, axis1, axis2)
take(self, *args, **kwargs)
tolist(self)
trace(self, *args, **kwargs)
transpose(self, *axes)

Static methods inherited from FiniteFieldArray:
diag(a, k=0)
gauss_det(a)
Determinant by Gaussian elimination on (last 2 dimensions of) array a.
gauss_inv(A)
Inverse by Gaussian elimination on augmented matrix (A | I).
gauss_solve(A, B)
Linear solve by Gaussian elimination on matrix (A | B).
matrix_pow(A, n)

Readonly properties inherited from FiniteFieldArray:
T
flat
ndim
shape
size

Data descriptors inherited from FiniteFieldArray:
value

Data and other attributes inherited from FiniteFieldArray:
__hash__ = None

 
class PrimeFieldElement(FiniteFieldElement)
    PrimeFieldElement(value)
 
Common base class for prime field elements.
 
 
Method resolution order:
PrimeFieldElement
FiniteFieldElement
builtins.object

Methods defined here:
__abs__(self)
Absolute value of (signed) value.
__init__(self, value)
Initialize self.  See help(type(self)) for accurate signature.
__int__(self)
Extract field element as a (signed) integer value.
__irshift__(self, other)
In-place right shift.
__pow__(self, other)
Exponentiation.
__reduce__(self)
Helper for pickle.
__repr__(self)
Return repr(self).
__rshift__(self, other)
Right shift.
signed_(self)
Return signed integer representation, symmetric around zero.
unsigned_(self)
Return unsigned integer representation.

Static methods defined here:
createGF(p, n, w)
Create new object for use by pickle module.

Data and other attributes defined here:
__annotations__ = {'modulus': <class 'int'>}
is_signed = None
nth = None
root = None

Methods inherited from FiniteFieldElement:
__add__(self, other)
Addition.
__array_function__(self, func, types, args, kwargs)
__bool__(self)
Truth value testing.
 
Return False if this field element is zero, True otherwise.
Field elements can thus be used directly in Boolean formulas.
__eq__(self, other)
Equality test.
__hash__(self)
Make finite field elements hashable (e.g., for LRU caching).
__iadd__(self, other)
In-place addition.
__ilshift__(self, other)
In-place left shift.
__imul__(self, other)
In-place multiplication.
__isub__(self, other)
In-place subtraction.
__itruediv__(self, other)
In-place division.
__lshift__(self, other)
Left shift.
__mul__(self, other)
Multiplication.
__neg__(self)
Negation.
__pos__(self)
Unary +.
__radd__(self, other)
Addition (with reflected arguments).
__rlshift__(self, other)
Left shift (with reflected arguments).
__rmul__(self, other)
Multiplication (with reflected arguments).
__rrshift__(self, other)
Right shift (with reflected arguments).
__rsub__(self, other)
Subtraction (with reflected arguments).
__rtruediv__(self, other)
Division (with reflected arguments).
__sub__(self, other)
Subtraction.
__truediv__(self, other)
Division.
is_sqr(self)
Test for quadratic residuosity (0 is also square).
reciprocal(self)
Multiplicative inverse.
sqrt(self, INV=False)
Modular (inverse) square root.

Class methods inherited from FiniteFieldElement:
from_bytes(data) from builtins.type
Return the list of integers represented by the given byte string.
to_bytes(x) from builtins.type
Return byte string representing the given list/ndarray of integers x.

Data descriptors inherited from FiniteFieldElement:
value

Data and other attributes inherited from FiniteFieldElement:
byte_length = None
characteristic = None
ext_deg = None
order = None

 
Functions
       
GF(modulus)
Create a finite (Galois) field for given modulus (prime number or irreducible polynomial).
 
Also creates corresponding array type.
find_irreducible(p, d)
Find smallest irreducible polynomial of degree d over GF(p).
find_prime_root(l, blum=True, n=1)
Find prime of bit length at least l satisfying given constraints.
 
Default is to return Blum primes (primes p with p % 4 == 3).
Also, a primitive root w is returned of prime order at least n (0 < w < p).
pGF(p, n, w)
Create a finite field for given prime modulus p.
xGF(modulus)
Create a finite field for given irreducible polynomial.