Class PolynomialMethods


  • public final class PolynomialMethods
    extends Object
    High-level methods for polynomials.
    Since:
    1.0
    • Method Detail

      • Factor

        public static <Poly extends IPolynomial<Poly>> PolynomialFactorDecomposition<Poly> Factor​(Poly poly)
        Factor polynomial.
        Parameters:
        poly - the polynomial
        Returns:
        irreducible factor decomposition
      • FactorSquareFree

        public static <Poly extends IPolynomial<Poly>> PolynomialFactorDecomposition<Poly> FactorSquareFree​(Poly poly)
        Square-free factorization of polynomial.
        Parameters:
        poly - the polynomial
        Returns:
        irreducible square-free factor decomposition
      • PolynomialGCD

        public static <Poly extends IPolynomial<Poly>> Poly PolynomialGCD​(Poly a,
                                                                          Poly b)
        Compute GCD of two polynomials.
        Parameters:
        a - the polynomial
        b - the polynomial
        Returns:
        the GCD
      • PolynomialGCD

        public static <Poly extends IPolynomial<Poly>> Poly PolynomialGCD​(Poly... array)
        Compute GCD of array of polynomials.
        Parameters:
        array - the polynomials
        Returns:
        the GCD
      • PolynomialGCD

        public static <Poly extends IPolynomial<Poly>> Poly PolynomialGCD​(Iterable<Poly> array)
        Compute GCD of collection of polynomials.
        Parameters:
        array - the polynomials
        Returns:
        the GCD
      • divideAndRemainder

        public static <Poly extends IPolynomial<Poly>> Poly[] divideAndRemainder​(Poly a,
                                                                                 Poly b)
        Returns quotient and remainder of a and b.
        Parameters:
        a - the dividend
        b - the divider
        Returns:
        {quotient, remainder}
      • remainder

        public static <Poly extends IPolynomial<Poly>> Poly remainder​(Poly a,
                                                                      Poly b)
        Returns quotient and remainder of a and b.
        Parameters:
        a - the dividend
        b - the divider
        Returns:
        {quotient, remainder}
      • divideOrNull

        public static <Poly extends IPolynomial<Poly>> Poly divideOrNull​(Poly a,
                                                                         Poly b)
        Returns the quotient of a and b or throws ArithmeticException if exact division is not possible
        Parameters:
        a - the dividend
        b - the divider
        Returns:
        quotient
        Throws:
        ArithmeticException - if exact division is not possible
      • divideExact

        public static <Poly extends IPolynomial<Poly>> Poly divideExact​(Poly a,
                                                                        Poly b)
        Returns the quotient of a and b or throws ArithmeticException if exact division is not possible
        Parameters:
        a - the dividend
        b - the divider
        Returns:
        quotient
        Throws:
        ArithmeticException - if exact division is not possible
      • coprimeQ

        public static <Poly extends IPolynomial<Poly>> boolean coprimeQ​(Poly... polynomials)
        Returns whether specified polynomials are coprime.
        Parameters:
        polynomials - the polynomials
        Returns:
        whether specified polynomials are coprime
      • coprimeQ

        public static <Poly extends IPolynomial<Poly>> boolean coprimeQ​(Iterable<Poly> polynomials)
        Returns whether specified polynomials are coprime.
        Parameters:
        polynomials - the polynomials
        Returns:
        whether specified polynomials are coprime
      • irreducibleQ

        public static <Poly extends IPolynomial<Poly>> boolean irreducibleQ​(Poly poly)
        Returns whether specified polynomial is irreducible
      • polyPow

        public static <T extends IPolynomial<T>> T polyPow​(T base,
                                                           BigInteger exponent,
                                                           boolean copy)
        Returns base in a power of non-negative exponent.
        Parameters:
        base - the base
        exponent - the non-negative exponent
        copy - whether to clone base; if not the data of base will be lost
        Returns:
        base in a power of e
      • polyPow

        public static <T extends IPolynomial<T>> T polyPow​(T base,
                                                           long exponent)
        Returns base in a power of non-negative exponent
        Parameters:
        base - the base
        exponent - the non-negative exponent
        Returns:
        base in a power of e
      • polyPow

        public static <T extends IPolynomial<T>> T polyPow​(T base,
                                                           BigInteger exponent)
        Returns base in a power of non-negative exponent
        Parameters:
        base - the base
        exponent - the non-negative exponent
        Returns:
        base in a power of e
      • polyPow

        public static <T extends IPolynomial<T>> T polyPow​(T base,
                                                           long exponent,
                                                           boolean copy)
        Returns base in a power of non-negative exponent
        Parameters:
        base - the base
        exponent - the non-negative exponent
        copy - whether to clone base; if not the data of base will be lost
        Returns:
        base in a power of e
      • polyPow

        public static <T extends IPolynomial<T>> T polyPow​(T base,
                                                           int exponent,
                                                           boolean copy,
                                                           gnu.trove.map.hash.TIntObjectHashMap<T> cache)
        Returns base in a power of non-negative exponent
        Parameters:
        base - the base
        exponent - the non-negative exponent
        copy - whether to clone base; if not the data of base will be lost
        cache - cache to store all intermediate powers
        Returns:
        base in a power of e