Poly
- type of univariate polynomialspublic final class UnivariateRing<Poly extends IUnivariatePolynomial<Poly>> extends ARing<Poly>
Modifier and Type | Field and Description |
---|---|
static int |
MAX_DEGREE_OF_RANDOM_POLY
The maximal degree of polynomial generated with
randomElement(RandomGenerator) |
static int |
MIN_DEGREE_OF_RANDOM_POLY
The minimal degree of polynomial generated with
randomElement(RandomGenerator) |
Constructor and Description |
---|
UnivariateRing(Poly factory)
Creates ring of univariate polynomials which support operations over univariate polynomials of the type same as
of provided
factory polynomial |
Modifier and Type | Method and Description |
---|---|
Poly |
add(Poly a,
Poly b)
Add two elements
|
Poly |
addMutable(Poly a,
Poly b)
Adds two elements and destroys the initial content of
a . |
BigInteger |
cardinality()
Returns the number of elements in this ring (cardinality) or null if ring is infinite
|
BigInteger |
characteristic()
Returns characteristic of this ring
|
int |
compare(Poly o1,
Poly o2) |
Poly |
copy(Poly element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).
|
Poly[] |
divideAndRemainder(Poly a,
Poly b)
Returns quotient and remainder of
dividend / divider |
boolean |
equals(Object o) |
Poly[] |
extendedGCD(Poly a,
Poly b)
Returns array of
[gcd(a,b), s, t] such that s * a + t * b = gcd(a, b) |
PolynomialFactorDecomposition<Poly> |
factor(Poly element)
Factor specified element
|
PolynomialFactorDecomposition<Poly> |
factorSquareFree(Poly element)
Square-free factorization of specified element
|
Poly |
factory()
Factory polynomial
|
Poly[] |
firstBezoutCoefficient(Poly a,
Poly b)
Returns array of
[gcd(a,b), s] such that s * a + t * b = gcd(a, b) |
Poly |
gcd(Poly a,
Poly b)
Returns the greatest common divisor of two elements
|
Poly |
getOne()
Returns unit element of this ring (one)
|
Poly |
getZero()
Returns zero element of this ring
|
int |
hashCode() |
boolean |
isEuclideanRing()
Returns whether this ring is a Euclidean ring
|
boolean |
isField()
Returns whether this ring is a field
|
boolean |
isOne(Poly element)
Tests whether specified element is one (exactly)
|
boolean |
isUnit(Poly element)
Tests whether specified element is a ring unit
|
boolean |
isZero(Poly element)
Tests whether specified element is zero
|
Iterator<Poly> |
iterator()
Returns iterator over ring elements (for finite rings, otherwise throws exception)
|
Poly |
multiply(Poly a,
Poly b)
Multiplies two elements
|
Poly |
multiplyMutable(Poly a,
Poly b)
Multiplies two elements and destroys the initial content of
a |
Poly |
negate(Poly element)
Negates the given element
|
Poly |
negateMutable(Poly element)
Negates the given element and destroys the initial content of
element |
int |
nVariables()
Number of polynomial variables
|
Poly |
parse(String string)
Parse string into ring element
|
Poly |
pow(Poly base,
BigInteger exponent)
Returns
base in a power of exponent (non negative) |
Poly |
randomElement(int minDegree,
int maxDegree,
org.apache.commons.math3.random.RandomGenerator rnd)
Gives a random univariate polynomial with the degree randomly picked from
minDegree (inclusive) to maxDegree (exclusive) |
Poly |
randomElement(int degree,
org.apache.commons.math3.random.RandomGenerator rnd)
Gives a random univariate polynomial with the specified degree
|
Poly |
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Gives a random univariate polynomial with the degree randomly picked from
MIN_DEGREE_OF_RANDOM_POLY
(inclusive) to MAX_DEGREE_OF_RANDOM_POLY (exclusive) |
Poly |
randomElementTree(int minDegree,
int maxDegree,
org.apache.commons.math3.random.RandomGenerator rnd)
Gives a random univariate polynomial with the degree randomly picked from
minDegree (inclusive) to maxDegree (exclusive) and coefficients generated via Ring.randomElementTree(RandomGenerator) method |
Poly |
randomElementTree(org.apache.commons.math3.random.RandomGenerator rnd)
Gives a random univariate polynomial with the degree randomly picked from
MIN_DEGREE_OF_RANDOM_POLY
(inclusive) to MAX_DEGREE_OF_RANDOM_POLY (exclusive) |
Poly |
reciprocal(Poly element)
Gives the inverse element
element ^ (-1) |
Poly |
remainder(Poly a,
Poly b)
Returns the remainder of
dividend / divider |
Poly |
subtract(Poly a,
Poly b)
Subtracts
b from a |
Poly |
subtractMutable(Poly a,
Poly b)
Subtracts
b from a and destroys the initial content of a |
String |
toString() |
String |
toString(IStringifier<Poly> stringifier)
convert this to string with the use of stringifier
|
String |
toString(String... variables) |
Poly |
valueOf(long val)
Returns ring element associated with specified
long |
Poly |
valueOf(Poly val)
Converts a value from other ring to this ring.
|
Poly |
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integer
|
Poly |
variable(int variable)
Creates poly representing a single specified variable
|
isPerfectPower, perfectPowerBase, perfectPowerExponent
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
mkCoder, parse, signum
abs, add, createArray, createArray, createArray, createArray, createArray2d, createArray2d, createZeroesArray, createZeroesArray2d, decrement, divideExact, divideExactMutable, divideOrNull, factorial, fillZeros, gcd, gcd, getNegativeOne, increment, isFinite, isFiniteField, isMinusOne, isPerfectPower, isUnitOrZero, lcm, lcm, lcm, max, min, multiply, multiply, multiply, perfectPowerBase, perfectPowerExponent, pow, pow, quotient, randomElement, randomElementTree, randomNonZeroElement, setToValueOf, valueOf
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
public static final int MIN_DEGREE_OF_RANDOM_POLY
randomElement(RandomGenerator)
public static final int MAX_DEGREE_OF_RANDOM_POLY
randomElement(RandomGenerator)
public UnivariateRing(Poly factory)
factory
polynomialfactory
- factory polynomial (the exact value of factory
is irrelevant)public int nVariables()
IPolynomialRing
public Poly remainder(Poly a, Poly b)
Ring
dividend / divider
a
- the dividendb
- the dividerdividend / divider
public Poly[] divideAndRemainder(Poly a, Poly b)
Ring
dividend / divider
a
- the dividendb
- the divider{quotient, remainder}
public Poly gcd(Poly a, Poly b)
Ring
a
- the first elementb
- the second elementpublic Poly[] extendedGCD(Poly a, Poly b)
Ring
[gcd(a,b), s, t]
such that s * a + t * b = gcd(a, b)
public Poly[] firstBezoutCoefficient(Poly a, Poly b)
Ring
[gcd(a,b), s]
such that s * a + t * b = gcd(a, b)
a
- the first ring element (for which the Bezout coefficient is computed)b
- the second ring element[gcd(a,b), s]
such that s * a + t * b = gcd(a, b)
public PolynomialFactorDecomposition<Poly> factorSquareFree(Poly element)
Ring
public PolynomialFactorDecomposition<Poly> factor(Poly element)
Ring
public Poly variable(int variable)
IPolynomialRing
public Poly randomElement(int minDegree, int maxDegree, org.apache.commons.math3.random.RandomGenerator rnd)
minDegree
(inclusive) to maxDegree
(exclusive)minDegree
- the minimal degree of the resultmaxDegree
- the maximal degree of the resultrnd
- the source of randomnessminDegree
(inclusive) to maxDegree
(exclusive)RandomUnivariatePolynomials
public Poly randomElement(int degree, org.apache.commons.math3.random.RandomGenerator rnd)
degree
- the degree of the resultrnd
- the source of randomnesspublic Poly randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
MIN_DEGREE_OF_RANDOM_POLY
(inclusive) to MAX_DEGREE_OF_RANDOM_POLY
(exclusive)rnd
- the source of randomnesspublic Poly randomElementTree(int minDegree, int maxDegree, org.apache.commons.math3.random.RandomGenerator rnd)
minDegree
(inclusive) to maxDegree
(exclusive) and coefficients generated via Ring.randomElementTree(RandomGenerator)
methodminDegree
- the minimal degree of the resultmaxDegree
- the maximal degree of the resultrnd
- the source of randomnessminDegree
(inclusive) to maxDegree
(exclusive)RandomUnivariatePolynomials
public Poly randomElementTree(org.apache.commons.math3.random.RandomGenerator rnd)
MIN_DEGREE_OF_RANDOM_POLY
(inclusive) to MAX_DEGREE_OF_RANDOM_POLY
(exclusive)rnd
- the source of randomnesspublic Poly factory()
IPolynomialRing
factory
in interface IPolynomialRing<Poly extends IPolynomial<Poly>>
public boolean isEuclideanRing()
Ring
isEuclideanRing
in interface Ring<Poly extends IPolynomial<Poly>>
public final boolean isField()
Ring
isField
in interface Ring<Poly extends IPolynomial<Poly>>
public final BigInteger cardinality()
Ring
cardinality
in interface Ring<Poly extends IPolynomial<Poly>>
public final BigInteger characteristic()
Ring
characteristic
in interface Ring<Poly extends IPolynomial<Poly>>
public final Poly add(Poly a, Poly b)
Ring
add
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first elementb
- the second elementpublic final Poly subtract(Poly a, Poly b)
Ring
b
from a
subtract
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first elementb
- the second elementpublic final Poly multiply(Poly a, Poly b)
Ring
multiply
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first elementb
- the second elementpublic final Poly negate(Poly element)
Ring
negate
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the ring elementpublic Poly pow(Poly base, BigInteger exponent)
Ring
base
in a power of exponent
(non negative)pow
in interface Ring<Poly extends IPolynomial<Poly>>
base
- baseexponent
- exponent (non negative)base
in a power of exponent
public Poly addMutable(Poly a, Poly b)
Ring
a
.addMutable
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first element (may be destroyed)b
- the second elementpublic Poly subtractMutable(Poly a, Poly b)
Ring
b
from a
and destroys the initial content of a
subtractMutable
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first element (may be destroyed)b
- the second elementpublic Poly multiplyMutable(Poly a, Poly b)
Ring
a
multiplyMutable
in interface Ring<Poly extends IPolynomial<Poly>>
a
- the first element (may be destroyed)b
- the second elementpublic Poly negateMutable(Poly element)
Ring
element
negateMutable
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the ring element (may be destroyed)public final Poly reciprocal(Poly element)
Ring
element ^ (-1)
reciprocal
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the elementelement ^ (-1)
public final Poly getZero()
Ring
getZero
in interface Ring<Poly extends IPolynomial<Poly>>
public final Poly getOne()
Ring
getOne
in interface Ring<Poly extends IPolynomial<Poly>>
public final boolean isZero(Poly element)
Ring
isZero
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the ring elementpublic final boolean isOne(Poly element)
Ring
isOne
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the ring elementRing.isUnit(Object)
public boolean isUnit(Poly element)
Ring
isUnit
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the ring elementRing.isOne(Object)
public final Poly valueOf(long val)
Ring
long
valueOf
in interface Ring<Poly extends IPolynomial<Poly>>
val
- machine integerlong
public Poly valueOfBigInteger(BigInteger val)
Ring
valueOfBigInteger
in interface Ring<Poly extends IPolynomial<Poly>>
val
- integerpublic final Poly valueOf(Poly val)
Ring
val
== valueOf(val)
is possible).valueOf
in interface Ring<Poly extends IPolynomial<Poly>>
val
- some element from any ringval
public Poly copy(Poly element)
Ring
copy
in interface Ring<Poly extends IPolynomial<Poly>>
element
- the elementpublic final int compare(Poly o1, Poly o2)
compare
in interface Comparator<Poly extends IPolynomial<Poly>>
public final boolean equals(Object o)
equals
in interface Comparator<Poly extends IPolynomial<Poly>>
equals
in class Object
public Iterator<Poly> iterator()
Ring
iterator
in interface Ring<Poly extends IPolynomial<Poly>>
iterator
in interface Iterable<Poly extends IPolynomial<Poly>>
public Poly parse(String string)
Ring
parse
in interface IParser<Poly extends IPolynomial<Poly>>
parse
in interface Ring<Poly extends IPolynomial<Poly>>
string
- stringCoder
public String toString(IStringifier<Poly> stringifier)
Stringifiable
toString
in interface Stringifiable<Poly extends IPolynomial<Poly>>
Copyright © 2018. All rights reserved.