Pol

Represents a polynomial from F_2[X].

Members

Functions

expand
string expand()

Returns the string representation of the polynomial x.

mulMod
Pol mulMod(Pol f, Pol g)

Computes this*f mod g.

opBinary
Pol opBinary(Pol y)

Returns this+y.

opBinary
Pol opBinary(Pol y)

Returns this*y. When an overflow occurs, throws an exception.

opBinary
Pol opBinary(Pol d)

Returns the integer division result this / d.

opBinary
Pol opBinary(Pol d)

Returns the remainder of this / d.

toString
string toString()

Returns the coefficients in hex.

Properties

deg
int deg [@property getter]

Returns the degree of the polynomial. If this is zero, -1 is returned.

irreducible
bool irreducible [@property getter]

Returns true iff x is irreducible over F_2. This function uses Ben Or's reducibility test. For details see "Tests and Constructions of Irreducible Polynomials over Finite Fields".

Static functions

derive
Pol derive(R source)

Returns an irreducible polynomial of degree 53 (largest prime number below 64-8) by reading bytes from source. There are (2^53-2/53) irreducible polynomials of degree 53 in F_2[X], c.f. Michael O. Rabin (1981): "Fingerprinting by Random Polynomials", page 4. If no polynomial could be found in one million tries, an error is returned.

divMod
Pol[2] divMod(Pol x, Pol d)

Returns quotient and remainder from division [x / d, x % d], see https://en.wikipedia.org/wiki/Division_algorithm

gcd
Pol gcd(Pol x, Pol f)

Computes the Greatest Common Divisor of x and f.

getRandom
Pol getRandom()

Returns a new random irreducible polynomial of degree 53 using the default rndGen as source. It is equivalent to calling derive(generate!(() => uniform!ubyte)).

Meta