Poly
- type of polynomials representing elements of this Galois fieldpublic final class FiniteField<Poly extends IUnivariatePolynomial<Poly>> extends ARing<Poly> implements IPolynomialRing<Poly>
Modifier and Type | Field and Description |
---|---|
static FiniteField<UnivariatePolynomialZp64> |
GF17p5
GF(17^5)
|
static FiniteField<UnivariatePolynomialZp64> |
GF27
GF(3^3)
|
plain
Constructor and Description |
---|
FiniteField(Poly irreducible)
Constructs finite field from the specified irreducible 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[] |
createArray(int length)
Creates generic array of ring elements of specified length
|
Poly[][] |
createArray2d(int length)
Creates 2d array of ring elements of specified length
|
Poly[][] |
createArray2d(int m,
int n)
Creates 2d array of ring elements of specified shape
|
Poly[] |
divideAndRemainder(Poly a,
Poly b)
Returns quotient and remainder of
dividend / divider |
boolean |
equals(Object o) |
FactorDecomposition<Poly> |
factor(Poly element)
Factor specified element
|
Poly |
factory()
Factory polynomial
|
Poly |
gcd(Poly a,
Poly b)
Returns the greatest common divisor of two elements
|
Poly |
getIrreducible()
Returns the irreducible polynomial that generates this finite field
|
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 all field elements
|
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 |
parse(String string,
String[] variables)
Parse string into polynomial
|
Poly |
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random element from this ring
|
Poly |
reciprocal(Poly element)
Gives the inverse element
element ^ (-1) |
Poly |
remainder(Poly dividend,
Poly divider)
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(String[] variables)
Returns string representation of this using specified string representation for variables.
|
String |
toString(String coefficientDomain,
String[] variables)
String representation of this ring.
|
String |
toString(String coefficientDomain,
ToStringSupport<Poly> irreducibleToString,
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 monomial corresponding to specified variable
|
isPerfectPower, perfectPowerBase, perfectPowerExponent
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, createArray, createArray, createArray, createZeroesArray, decrement, divideExact, divideOrNull, extendedGCD, factorial, factorSquareFree, gcd, gcd, getNegativeOne, increment, isFinite, isFiniteField, isMinusOne, isPerfectPower, isUnitOrZero, lcm, multiply, perfectPowerBase, perfectPowerExponent, pow, pow, pow, quotient, randomElement, randomNonZeroElement, setToValueOf, signum, toString, valueOf
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
forEach, spliterator
plain, withVariables
defaultVars
public static final FiniteField<UnivariatePolynomialZp64> GF27
public static final FiniteField<UnivariatePolynomialZp64> GF17p5
public FiniteField(Poly irreducible)
IrreduciblePolynomials.irreducibleQ(IUnivariatePolynomial)
to test
irreducibility.irreducible
- irreducible polynomialpublic Poly getIrreducible()
public int nVariables()
IPolynomialRing
nVariables
in interface IPolynomialRing<Poly extends IUnivariatePolynomial<Poly>>
public Poly factory()
IPolynomialRing
factory
in interface IPolynomialRing<Poly extends IUnivariatePolynomial<Poly>>
public boolean isField()
Ring
isField
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public boolean isEuclideanRing()
Ring
isEuclideanRing
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public BigInteger cardinality()
Ring
cardinality
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public BigInteger characteristic()
Ring
characteristic
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public Poly add(Poly a, Poly b)
Ring
add
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
a
- the first elementb
- the second elementpublic Poly subtract(Poly a, Poly b)
Ring
b
from a
subtract
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
a
- the first elementb
- the second elementpublic Poly multiply(Poly a, Poly b)
Ring
multiply
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
a
- the first elementb
- the second elementpublic Poly negate(Poly element)
Ring
negate
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the ring elementpublic Poly addMutable(Poly a, Poly b)
Ring
a
.addMutable
in interface Ring<Poly extends IUnivariatePolynomial<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 IUnivariatePolynomial<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 IUnivariatePolynomial<Poly>>
a
- the first element (may be destroyed)b
- the second elementpublic Poly negateMutable(Poly element)
Ring
element
negateMutable
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the ring element (may be destroyed)public Poly[] divideAndRemainder(Poly a, Poly b)
Ring
dividend / divider
divideAndRemainder
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
a
- the dividendb
- the divider{quotient, remainder}
public Poly remainder(Poly dividend, Poly divider)
Ring
dividend / divider
remainder
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
dividend
- the dividenddivider
- the dividerdividend / divider
public Poly reciprocal(Poly element)
Ring
element ^ (-1)
reciprocal
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the elementelement ^ (-1)
public Poly gcd(Poly a, Poly b)
Ring
gcd
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
a
- the first elementb
- the second elementpublic FactorDecomposition<Poly> factor(Poly element)
Ring
factor
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public Poly getZero()
Ring
getZero
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public Poly getOne()
Ring
getOne
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
public boolean isZero(Poly element)
Ring
isZero
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the ring elementpublic boolean isOne(Poly element)
Ring
isOne
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the ring elementRing.isUnit(Object)
public boolean isUnit(Poly element)
Ring
isUnit
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the ring elementRing.isOne(Object)
public Poly valueOf(long val)
Ring
long
valueOf
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
val
- machine integerlong
public Poly valueOfBigInteger(BigInteger val)
Ring
valueOfBigInteger
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
val
- integerpublic Poly valueOf(Poly val)
Ring
valueOf
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
val
- some element from any ringval
public Poly copy(Poly element)
Ring
copy
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
element
- the elementpublic Poly[] createArray(int length)
Ring
createArray
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
length
- array lengthlength
public Poly[][] createArray2d(int length)
Ring
createArray2d
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
length
- array lengthlength
public Poly[][] createArray2d(int m, int n)
Ring
createArray2d
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
m
- result lengthn
- length of each array in the resultpublic int compare(Poly o1, Poly o2)
compare
in interface Comparator<Poly extends IUnivariatePolynomial<Poly>>
public Poly randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Ring
randomElement
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
rnd
- the source of randomnesspublic Poly variable(int variable)
IPolynomialRing
variable
in interface IPolynomialRing<Poly extends IUnivariatePolynomial<Poly>>
public Poly parse(String string)
Ring
parse
in interface ElementParser<Poly extends IUnivariatePolynomial<Poly>>
parse
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
string
- stringpublic Poly parse(String string, String[] variables)
IPolynomialRing
parse
in interface IPolynomialRing<Poly extends IUnivariatePolynomial<Poly>>
string
- stringvariables
- names of variablespublic Iterator<Poly> iterator()
iterator
in interface Ring<Poly extends IUnivariatePolynomial<Poly>>
iterator
in interface Iterable<Poly extends IUnivariatePolynomial<Poly>>
public boolean equals(Object o)
equals
in interface Comparator<Poly extends IUnivariatePolynomial<Poly>>
equals
in class Object
public String toString(String[] variables)
WithVariables
toString
in interface WithVariables
variables
- string values of variablespublic String toString(String coefficientDomain, String[] variables)
IPolynomialRing
toString
in interface IPolynomialRing<Poly extends IUnivariatePolynomial<Poly>>
coefficientDomain
- coefficient ringvariables
- variable namespublic String toString(String coefficientDomain, ToStringSupport<Poly> irreducibleToString, String[] variables)
Copyright © 2017. All rights reserved.