Class PolynomialRingGF2


  • public final class PolynomialRingGF2
    extends java.lang.Object
    This class describes operations with polynomials over finite field GF(2), i e polynomial ring R = GF(2)[X]. All operations are defined only for polynomials with degree <=32. For the polynomial representation the map f: R->Z, poly(X)->poly(2) is used, where integers have the binary representation. For example: X^7+X^3+X+1 -> (00...0010001011)=139 Also for polynomials type Integer is used.
    See Also:
    GF2mField
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int add​(int p, int q)
      Return sum of two polyomials
      static int degree​(int p)
      Return the degree of a polynomial
      static int degree​(long p)
      Return the degree of a polynomial
      static int gcd​(int p, int q)
      Return the greatest common divisor of two polynomials
      static int getIrreduciblePolynomial​(int deg)
      Creates irreducible polynomial with degree d
      static boolean isIrreducible​(int p)
      Checking polynomial for irreducibility
      static int modMultiply​(int a, int b, int r)
      Compute the product of two polynomials modulo a third polynomial.
      static long multiply​(int p, int q)
      Return product of two polynomials
      static int remainder​(int p, int q)
      Return the remainder of a polynomial division of two polynomials.
      static int rest​(long p, int q)
      Return the rest of devision two polynomials
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • add

        public static int add​(int p,
                              int q)
        Return sum of two polyomials
        Parameters:
        p - polynomial
        q - polynomial
        Returns:
        p+q
      • multiply

        public static long multiply​(int p,
                                    int q)
        Return product of two polynomials
        Parameters:
        p - polynomial
        q - polynomial
        Returns:
        p*q
      • modMultiply

        public static int modMultiply​(int a,
                                      int b,
                                      int r)
        Compute the product of two polynomials modulo a third polynomial.
        Parameters:
        a - the first polynomial
        b - the second polynomial
        r - the reduction polynomial
        Returns:
        a * b mod r
      • degree

        public static int degree​(int p)
        Return the degree of a polynomial
        Parameters:
        p - polynomial p
        Returns:
        degree(p)
      • degree

        public static int degree​(long p)
        Return the degree of a polynomial
        Parameters:
        p - polynomial p
        Returns:
        degree(p)
      • remainder

        public static int remainder​(int p,
                                    int q)
        Return the remainder of a polynomial division of two polynomials.
        Parameters:
        p - dividend
        q - divisor
        Returns:
        p mod q
      • rest

        public static int rest​(long p,
                               int q)
        Return the rest of devision two polynomials
        Parameters:
        p - polinomial
        q - polinomial
        Returns:
        p mod q
      • gcd

        public static int gcd​(int p,
                              int q)
        Return the greatest common divisor of two polynomials
        Parameters:
        p - polinomial
        q - polinomial
        Returns:
        GCD(p, q)
      • isIrreducible

        public static boolean isIrreducible​(int p)
        Checking polynomial for irreducibility
        Parameters:
        p - polinomial
        Returns:
        true if p is irreducible and false otherwise
      • getIrreduciblePolynomial

        public static int getIrreduciblePolynomial​(int deg)
        Creates irreducible polynomial with degree d
        Parameters:
        deg - polynomial degree
        Returns:
        irreducible polynomial p