Package cc.redberry.rings.poly
Class PolynomialMethods
- java.lang.Object
-
- cc.redberry.rings.poly.PolynomialMethods
-
public final class PolynomialMethods extends Object
High-level methods for polynomials.- Since:
- 1.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <Poly extends IPolynomial<Poly>>
booleancoprimeQ(Iterable<Poly> polynomials)Returns whether specified polynomials are coprime.static <Poly extends IPolynomial<Poly>>
booleancoprimeQ(Poly... polynomials)Returns whether specified polynomials are coprime.static <Poly extends IPolynomial<Poly>>
Poly[]divideAndRemainder(Poly a, Poly b)Returns quotient and remainder of a and b.static <Poly extends IPolynomial<Poly>>
PolydivideExact(Poly a, Poly b)Returns the quotient of a and b or throwsArithmeticExceptionif exact division is not possiblestatic <Poly extends IPolynomial<Poly>>
PolydivideOrNull(Poly a, Poly b)Returns the quotient of a and b or throwsArithmeticExceptionif exact division is not possiblestatic <Poly extends IPolynomial<Poly>>
PolynomialFactorDecomposition<Poly>Factor(Poly poly)Factor polynomial.static <Poly extends IPolynomial<Poly>>
PolynomialFactorDecomposition<Poly>FactorSquareFree(Poly poly)Square-free factorization of polynomial.static <Poly extends IPolynomial<Poly>>
booleanirreducibleQ(Poly poly)Returns whether specified polynomial is irreduciblestatic <T extends IUnivariatePolynomial<T>>
T[]PolynomialExtendedGCD(T a, T b)Computes[gcd(a,b), s, t]such thats * a + t * b = gcd(a, b).static <Poly extends IPolynomial<Poly>>
PolyPolynomialGCD(Iterable<Poly> array)Compute GCD of collection of polynomials.static <Poly extends IPolynomial<Poly>>
PolyPolynomialGCD(Poly... array)Compute GCD of array of polynomials.static <Poly extends IPolynomial<Poly>>
PolyPolynomialGCD(Poly a, Poly b)Compute GCD of two polynomials.static <T extends IPolynomial<T>>
TpolyPow(T base, int exponent, boolean copy, gnu.trove.map.hash.TIntObjectHashMap<T> cache)Returnsbasein a power of non-negativeexponentstatic <T extends IPolynomial<T>>
TpolyPow(T base, long exponent)Returnsbasein a power of non-negativeexponentstatic <T extends IPolynomial<T>>
TpolyPow(T base, long exponent, boolean copy)Returnsbasein a power of non-negativeexponentstatic <T extends IPolynomial<T>>
TpolyPow(T base, BigInteger exponent)Returnsbasein a power of non-negativeexponentstatic <T extends IPolynomial<T>>
TpolyPow(T base, BigInteger exponent, boolean copy)Returnsbasein a power of non-negativeexponent.static <Poly extends IPolynomial<Poly>>
Polyremainder(Poly a, Poly b)Returns quotient and remainder of a and b.
-
-
-
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 polynomialb- 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
-
PolynomialExtendedGCD
public static <T extends IUnivariatePolynomial<T>> T[] PolynomialExtendedGCD(T a, T b)
Computes[gcd(a,b), s, t]such thats * a + t * b = gcd(a, b). Half-GCD algorithm is used.- Parameters:
a- the univariate polynomialb- the univariate polynomial- Returns:
- array of
[gcd(a,b), s, t]such thats * a + t * b = gcd(a, b)(gcd is monic) - See Also:
UnivariateGCD.PolynomialExtendedGCD(IUnivariatePolynomial, IUnivariatePolynomial)
-
divideAndRemainder
public static <Poly extends IPolynomial<Poly>> Poly[] divideAndRemainder(Poly a, Poly b)
Returns quotient and remainder of a and b.- Parameters:
a- the dividendb- 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 dividendb- 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 throwsArithmeticExceptionif exact division is not possible- Parameters:
a- the dividendb- 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 throwsArithmeticExceptionif exact division is not possible- Parameters:
a- the dividendb- 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)
Returnsbasein a power of non-negativeexponent.- Parameters:
base- the baseexponent- the non-negative exponentcopy- whether to clonebase; if not the data ofbasewill be lost- Returns:
basein a power ofe
-
polyPow
public static <T extends IPolynomial<T>> T polyPow(T base, long exponent)
Returnsbasein a power of non-negativeexponent- Parameters:
base- the baseexponent- the non-negative exponent- Returns:
basein a power ofe
-
polyPow
public static <T extends IPolynomial<T>> T polyPow(T base, BigInteger exponent)
Returnsbasein a power of non-negativeexponent- Parameters:
base- the baseexponent- the non-negative exponent- Returns:
basein a power ofe
-
polyPow
public static <T extends IPolynomial<T>> T polyPow(T base, long exponent, boolean copy)
Returnsbasein a power of non-negativeexponent- Parameters:
base- the baseexponent- the non-negative exponentcopy- whether to clonebase; if not the data ofbasewill be lost- Returns:
basein a power ofe
-
polyPow
public static <T extends IPolynomial<T>> T polyPow(T base, int exponent, boolean copy, gnu.trove.map.hash.TIntObjectHashMap<T> cache)
Returnsbasein a power of non-negativeexponent- Parameters:
base- the baseexponent- the non-negative exponentcopy- whether to clonebase; if not the data ofbasewill be lostcache- cache to store all intermediate powers- Returns:
basein a power ofe
-
-