| |
- builtins.object
-
- Polynomial
-
- BinaryPolynomial
class BinaryPolynomial(Polynomial) |
|
BinaryPolynomial(value=0, check=True)
Polynomials over GF(2) represented as nonnegative integers. |
|
- Method resolution order:
- BinaryPolynomial
- Polynomial
- builtins.object
Methods defined here:
- __call__(self, x)
- Evaluate polynomial at given x.
- __hash__(self)
- Make polynomials hashable (e.g., for LRU caching).
- __int__(self)
- __iter__(self)
- to_bytes(self, length, byteorder)
- Return a bytes object representing a polynomial.
Data and other attributes defined here:
- p = 2
Methods inherited from Polynomial:
- __add__(self, other)
- __bool__(self)
- Truth value testing.
Return False if this polynomial is zero, True otherwise.
- __divmod__(self, other)
- __eq__(self, other)
- Equality test.
- __floordiv__(self, other)
- __ge__(self, other)
- Greater-than or equal comparison.
- __getitem__(self, key)
- __gt__(self, other)
- Strictly greater-than comparison.
- __init__(self, value=0, check=True)
- Initialize polynomial to given value (zero polynomial, by default).
- __le__(self, other)
- Less-than or equal comparison.
- __lshift__(self, other)
- __lt__(self, other)
- Strictly less-than comparison.
- __mod__(self, other)
- __mul__(self, other)
- __ne__(self, other)
- Negated equality test.
- __neg__(self)
- __pos__(self)
- __pow__(self, other)
- __radd__ = __add__(self, other)
- __rdivmod__(self, other)
- __repr__(self)
- Return repr(self).
- __rfloordiv__(self, other)
- __rlshift__(self, other)
- __rmod__(self, other)
- __rmul__ = __mul__(self, other)
- __rrshift__(self, other)
- __rshift__(self, other)
- __rsub__(self, other)
- __sub__(self, other)
- degree(self)
- Degree of polynomial (-1 for zero polynomial).
- monic(self, lc_pinv=False)
- Monic version of polynomial.
Zero polynomial remains unchanged.
If lc_pinv is set, inverse of leading coefficient is also returned (0 for zero polynomial).
- reverse(self, d=None)
- Reverse of polynomial (basically, coefficients in reverse order).
For example, reverse of x + 2x^2 + 3x^3 is 3 + 2x + x^2.
If d is None (default), d is set to the degree of the given poynomial.
Otherwise, the given polynomial is first padded with zeros or truncated
to attain the given degree d, d>=-1, before it is reversed.
Class methods inherited from Polynomial:
- add(a, b) from builtins.type
- Add polynomials a and b.
- deg(a) from builtins.type
- Degree of polynomial a (-1 if a is zero polynomial).
- divmod(a, b) from builtins.type
- Divide polynomial a by polynomial b with remainder, for nonzero b.
- from_terms(s, x='x') from builtins.type
- Convert string s with sum of powers of x to a polynomial.
- gcd(a, b) from builtins.type
- Greatest common divisor of polynomials a and b.
- gcdext(a, b) from builtins.type
- Extended GCD for polynomials a and b.
Return d, s, t satisfying s a + t b = d = gcd(a,b).
- invert(a, b) from builtins.type
- Inverse of polynomial a modulo polynomial b, for nonzero b.
- is_irreducible(a) from builtins.type
- Test polynomial a for irreducibility.
- lshift(a, n) from builtins.type
- Multiply polynomial a by X^n.
- mod(a, b) from builtins.type
- Reduce polynomial a modulo polynomial b, for nonzero b.
- mul(a, b) from builtins.type
- Multiply polynomials a and b.
- next_irreducible(a) from builtins.type
- Return lexicographically next monic irreducible polynomial > a.
E.g., X < X+1 < X^2+X+1 < X^3+X+1 < X^3+X^2+1 < ... for p=2.
- powmod(a, n, b) from builtins.type
- Polynomial a to the power of n modulo polynomial b, for nonzero b.
- rshift(a, n) from builtins.type
- Quotient for polynomial a divided by X^n, assuming a is multiple of X^n.
- sub(a, b) from builtins.type
- Subtract polynomials a and b.
- to_terms(a, x='x') from builtins.type
- Convert polynomial a to a string with sum of powers of x.
Data descriptors inherited from Polynomial:
- value
|
class Polynomial(builtins.object) |
|
Polynomial(value=0, check=True)
Polynomials over GF(p) represented as lists of integers in {0, ... , p-1}.
Invariant: last element of attribute 'value' is a nonzero integer (if 'value' nonempty). |
|
Methods defined here:
- __add__(self, other)
- __bool__(self)
- Truth value testing.
Return False if this polynomial is zero, True otherwise.
- __call__(self, x)
- Evaluate polynomial at given x.
- __divmod__(self, other)
- __eq__(self, other)
- Equality test.
- __floordiv__(self, other)
- __ge__(self, other)
- Greater-than or equal comparison.
- __getitem__(self, key)
- __gt__(self, other)
- Strictly greater-than comparison.
- __hash__(self)
- Make polynomials hashable (e.g., for LRU caching).
- __init__(self, value=0, check=True)
- Initialize polynomial to given value (zero polynomial, by default).
- __int__(self)
- __iter__(self)
- __le__(self, other)
- Less-than or equal comparison.
- __lshift__(self, other)
- __lt__(self, other)
- Strictly less-than comparison.
- __mod__(self, other)
- __mul__(self, other)
- __ne__(self, other)
- Negated equality test.
- __neg__(self)
- __pos__(self)
- __pow__(self, other)
- __radd__ = __add__(self, other)
- __rdivmod__(self, other)
- __repr__(self)
- Return repr(self).
- __rfloordiv__(self, other)
- __rlshift__(self, other)
- __rmod__(self, other)
- __rmul__ = __mul__(self, other)
- __rrshift__(self, other)
- __rshift__(self, other)
- __rsub__(self, other)
- __sub__(self, other)
- degree(self)
- Degree of polynomial (-1 for zero polynomial).
- monic(self, lc_pinv=False)
- Monic version of polynomial.
Zero polynomial remains unchanged.
If lc_pinv is set, inverse of leading coefficient is also returned (0 for zero polynomial).
- reverse(self, d=None)
- Reverse of polynomial (basically, coefficients in reverse order).
For example, reverse of x + 2x^2 + 3x^3 is 3 + 2x + x^2.
If d is None (default), d is set to the degree of the given poynomial.
Otherwise, the given polynomial is first padded with zeros or truncated
to attain the given degree d, d>=-1, before it is reversed.
- to_bytes(self, length, byteorder)
- Return a bytes object representing a polynomial.
Class methods defined here:
- add(a, b) from builtins.type
- Add polynomials a and b.
- deg(a) from builtins.type
- Degree of polynomial a (-1 if a is zero polynomial).
- divmod(a, b) from builtins.type
- Divide polynomial a by polynomial b with remainder, for nonzero b.
- from_terms(s, x='x') from builtins.type
- Convert string s with sum of powers of x to a polynomial.
- gcd(a, b) from builtins.type
- Greatest common divisor of polynomials a and b.
- gcdext(a, b) from builtins.type
- Extended GCD for polynomials a and b.
Return d, s, t satisfying s a + t b = d = gcd(a,b).
- invert(a, b) from builtins.type
- Inverse of polynomial a modulo polynomial b, for nonzero b.
- is_irreducible(a) from builtins.type
- Test polynomial a for irreducibility.
- lshift(a, n) from builtins.type
- Multiply polynomial a by X^n.
- mod(a, b) from builtins.type
- Reduce polynomial a modulo polynomial b, for nonzero b.
- mul(a, b) from builtins.type
- Multiply polynomials a and b.
- next_irreducible(a) from builtins.type
- Return lexicographically next monic irreducible polynomial > a.
E.g., X < X+1 < X^2+X+1 < X^3+X+1 < X^3+X^2+1 < ... for p=2.
- powmod(a, n, b) from builtins.type
- Polynomial a to the power of n modulo polynomial b, for nonzero b.
- rshift(a, n) from builtins.type
- Quotient for polynomial a divided by X^n, assuming a is multiple of X^n.
- sub(a, b) from builtins.type
- Subtract polynomials a and b.
- to_terms(a, x='x') from builtins.type
- Convert polynomial a to a string with sum of powers of x.
Data descriptors defined here:
- value
Data and other attributes defined here:
- p = None
| |