Package cc.redberry.rings.poly
Class SimpleFieldExtension<E extends IUnivariatePolynomial<E>>
java.lang.Object
cc.redberry.rings.ARing<E>
cc.redberry.rings.poly.SimpleFieldExtension<E>
- All Implemented Interfaces:
IParser<E>
,Stringifiable<E>
,IPolynomialRing<E>
,Ring<E>
,Serializable
,Iterable<E>
,Comparator<E>
- Direct Known Subclasses:
AlgebraicNumberField
,FiniteField
public abstract class SimpleFieldExtension<E extends IUnivariatePolynomial<E>> extends ARing<E> implements IPolynomialRing<E>
A simple field extension
F(α)
represented as a univariate quotient ring F[x]/<m(x)>
where
m(x)
is the minimal polynomial of α
. Elements of extension field are represented as univariate polynomials
in α
. To create simple field extensions one should use either FiniteField
for extensions of finite
fields or AlgebraicNumberField
for extensions of rationals. See MultipleFieldExtension
for
implementation of multiple extensions.-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleFieldExtension(E minimalPoly)
Constructs a simple field extensionF(α)
generated by the algebraic numberα
with the specified minimal polynomial. -
Method Summary
Modifier and Type Method Description E
add(E a, E b)
Add two elementsE
addMutable(E a, E b)
Adds two elements and destroys the initial content ofa
.<Term extends AMonomial<Term>, mPoly extends AMultivariatePolynomial<Term, mPoly>>
MultipleFieldExtension<Term,mPoly,E>asMultipleExtension()
Returns a view of this as a multiple field extensionBigInteger
cardinality()
Returns the number of elements in this ring (cardinality) or null if ring is infiniteBigInteger
characteristic()
Returns characteristic of this ringint
compare(E o1, E o2)
E
conjugatesProduct(E element)
Gives the product of all conjugates of given element (except element itself), that isnorm(element) / element
E
copy(E element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).E[]
createArray(int length)
Creates generic array of ring elements of specified lengthE[][]
createArray2d(int length)
Creates 2d array of ring elements of specified lengthE[][]
createArray2d(int m, int n)
Creates 2d array of ring elements of specified shapeint
degree()
Returns the degree of this filed extension (that is the degree of minimal polynomial)boolean
equals(Object o)
FactorDecomposition<E>
factor(E element)
Factor specified elementE
factory()
Factory polynomialE
generator()
Returns the generator elementα
of this field extensionF(α)
E
getMinimalPolynomial()
Returns the minimal polynomial of the generator (that is the "modulo" polynomialp(x)
of this field viewed as quotient fieldF[x]/<p(x)>
)E
getMinimalPolynomialRef()
INTERNALE
getOne()
Returns unit element of this ring (one)E
getZero()
Returns zero element of this ringint
hashCode()
boolean
isEuclideanRing()
Returns whether this ring is a Euclidean ringboolean
isInTheBaseField(E element)
Returns whether the given element belongs to the base fieldboolean
isOne(E element)
Tests whether specified element is one (exactly)boolean
isZero(E element)
Tests whether specified element is zeroE
minimalPolynomial(E element)
Computes minimal polynomial of a given algebraic elementE
multiply(E a, E b)
Multiplies two elementsE
multiplyMutable(E a, E b)
Multiplies two elements and destroys the initial content ofa
E
negate(E element)
Negates the given elementE
negateMutable(E element)
Negates the given element and destroys the initial content ofelement
E
norm(E element)
Gives the norm of field extension element (it is always belongs to the base field)<MPoly extends AMultivariatePolynomial>
MPolynormOfPolynomial(MultivariatePolynomial<E> poly)
Gives the norm of multivariate polynomial over this field extension, which is always a polynomial with the coefficients from the base field.E
normOfPolynomial(UnivariatePolynomial<E> poly)
Gives the norm of univariate polynomial over this field extension, which is always a polynomial with the coefficients from the base fieldint
nVariables()
Number of polynomial variablesE
parse(String string)
Parse string into ring elementE
randomElement(org.apache.commons.math3.random.RandomGenerator rnd)
Returns a random element from this ringE
reciprocal(E element)
Gives the inverse elementelement ^ (-1)
protected boolean
shouldReduceFast(int dividendDegree)
empiric to switch between fast and plain divisionE
subtract(E a, E b)
Subtractsb
froma
E
subtractMutable(E a, E b)
Subtractsb
froma
and destroys the initial content ofa
String
toString()
String
toString(IStringifier<E> stringifier)
convert this to string with the use of stringifierString
toString(String... variables)
E
trace(E element)
Gives the trace of field extension element (it is always belongs to the base field)E
valueOf(long val)
Returns ring element associated with specifiedlong
E
valueOf(E val)
Converts a value from other ring to this ring.E
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integerE
variable(int variable)
Creates poly representing a single specified variableMethods inherited from class cc.redberry.rings.ARing
isPerfectPower, perfectPowerBase, perfectPowerExponent
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface cc.redberry.rings.poly.IPolynomialRing
mkCoder, parse, signum
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface cc.redberry.rings.Ring
abs, add, createArray, createArray, createArray, createZeroesArray, createZeroesArray2d, decrement, divideAndRemainder, divideExact, divideExactMutable, divideOrNull, extendedGCD, factorial, factorSquareFree, fillZeros, firstBezoutCoefficient, gcd, gcd, gcd, getNegativeOne, increment, isField, isFinite, isFiniteField, isMinusOne, isPerfectPower, isUnit, isUnitOrZero, iterator, lcm, lcm, lcm, max, min, multiply, multiply, multiply, perfectPowerBase, perfectPowerExponent, pow, pow, pow, quotient, randomElement, randomElementTree, randomElementTree, randomNonZeroElement, remainder, setToValueOf, valueOf
-
Constructor Details
-
SimpleFieldExtension
Constructs a simple field extensionF(α)
generated by the algebraic numberα
with the specified minimal polynomial.NOTE: irreducibility test for the minimal polynomial is not performed here, use
IrreduciblePolynomials.irreducibleQ(IUnivariatePolynomial)
to test irreducibility.- Parameters:
minimalPoly
- the minimal polynomial
-
-
Method Details
-
isInTheBaseField
Returns whether the given element belongs to the base field -
generator
Returns the generator elementα
of this field extensionF(α)
-
degree
public int degree()Returns the degree of this filed extension (that is the degree of minimal polynomial) -
getMinimalPolynomial
Returns the minimal polynomial of the generator (that is the "modulo" polynomialp(x)
of this field viewed as quotient fieldF[x]/<p(x)>
) -
getMinimalPolynomialRef
INTERNAL -
norm
Gives the norm of field extension element (it is always belongs to the base field) -
conjugatesProduct
Gives the product of all conjugates of given element (except element itself), that isnorm(element) / element
-
trace
Gives the trace of field extension element (it is always belongs to the base field) -
normOfPolynomial
Gives the norm of univariate polynomial over this field extension, which is always a polynomial with the coefficients from the base field -
normOfPolynomial
public <MPoly extends AMultivariatePolynomial> MPoly normOfPolynomial(MultivariatePolynomial<E> poly)Gives the norm of multivariate polynomial over this field extension, which is always a polynomial with the coefficients from the base field. -
minimalPolynomial
Computes minimal polynomial of a given algebraic element -
asMultipleExtension
public <Term extends AMonomial<Term>, mPoly extends AMultivariatePolynomial<Term, mPoly>> MultipleFieldExtension<Term,mPoly,E> asMultipleExtension()Returns a view of this as a multiple field extension -
nVariables
public int nVariables()Description copied from interface:IPolynomialRing
Number of polynomial variables- Specified by:
nVariables
in interfaceIPolynomialRing<E extends IUnivariatePolynomial<E>>
-
factory
Description copied from interface:IPolynomialRing
Factory polynomial- Specified by:
factory
in interfaceIPolynomialRing<E extends IUnivariatePolynomial<E>>
-
isEuclideanRing
public boolean isEuclideanRing()Description copied from interface:Ring
Returns whether this ring is a Euclidean ring- Specified by:
isEuclideanRing
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Returns:
- whether this ring is a Euclidean ring
-
cardinality
Description copied from interface:Ring
Returns the number of elements in this ring (cardinality) or null if ring is infinite- Specified by:
cardinality
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Returns:
- the number of elements in this ring (cardinality) or null if ring is infinite
-
characteristic
Description copied from interface:Ring
Returns characteristic of this ring- Specified by:
characteristic
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Returns:
- characteristic of this ring
-
shouldReduceFast
protected boolean shouldReduceFast(int dividendDegree)empiric to switch between fast and plain division -
add
Description copied from interface:Ring
Add two elements- Specified by:
add
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first elementb
- the second element- Returns:
- a + b
-
subtract
Description copied from interface:Ring
Subtractsb
froma
- Specified by:
subtract
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first elementb
- the second element- Returns:
- a - b
-
multiply
Description copied from interface:Ring
Multiplies two elements- Specified by:
multiply
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first elementb
- the second element- Returns:
- a * b
-
negate
Description copied from interface:Ring
Negates the given element- Specified by:
negate
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the ring element- Returns:
- -val
-
addMutable
Description copied from interface:Ring
Adds two elements and destroys the initial content ofa
.- Specified by:
addMutable
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first element (may be destroyed)b
- the second element- Returns:
- a + b
-
subtractMutable
Description copied from interface:Ring
Subtractsb
froma
and destroys the initial content ofa
- Specified by:
subtractMutable
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first element (may be destroyed)b
- the second element- Returns:
- a - b
-
multiplyMutable
Description copied from interface:Ring
Multiplies two elements and destroys the initial content ofa
- Specified by:
multiplyMutable
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
a
- the first element (may be destroyed)b
- the second element- Returns:
- a * b
-
negateMutable
Description copied from interface:Ring
Negates the given element and destroys the initial content ofelement
- Specified by:
negateMutable
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the ring element (may be destroyed)- Returns:
- -element
-
reciprocal
Description copied from interface:Ring
Gives the inverse elementelement ^ (-1)
- Specified by:
reciprocal
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the element- Returns:
element ^ (-1)
-
factor
Description copied from interface:Ring
Factor specified element- Specified by:
factor
in interfaceRing<E extends IUnivariatePolynomial<E>>
-
getZero
Description copied from interface:Ring
Returns zero element of this ring- Specified by:
getZero
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Returns:
- 0
-
getOne
Description copied from interface:Ring
Returns unit element of this ring (one)- Specified by:
getOne
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Returns:
- 1
-
isZero
Description copied from interface:Ring
Tests whether specified element is zero- Specified by:
isZero
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the ring element- Returns:
- whether specified element is zero
-
isOne
Description copied from interface:Ring
Tests whether specified element is one (exactly)- Specified by:
isOne
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the ring element- Returns:
- whether specified element is exactly one
- See Also:
Ring.isUnit(Object)
-
valueOf
Description copied from interface:Ring
Returns ring element associated with specifiedlong
- Specified by:
valueOf
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
val
- machine integer- Returns:
- ring element associated with specified
long
-
valueOfBigInteger
Description copied from interface:Ring
Returns ring element associated with specified integer- Specified by:
valueOfBigInteger
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
val
- integer- Returns:
- ring element associated with specified integer
-
valueOf
Description copied from interface:Ring
Converts a value from other ring to this ring. The result is not guarantied to be a new instance (i.e.val == valueOf(val)
is possible).- Specified by:
valueOf
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
val
- some element from any ring- Returns:
- this ring element associated with specified
val
-
copy
Description copied from interface:Ring
Makes a deep copy of the specified element (for immutable instances the same reference returned).- Specified by:
copy
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
element
- the element- Returns:
- deep copy of specified element
-
createArray
Description copied from interface:Ring
Creates generic array of ring elements of specified length- Specified by:
createArray
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
length
- array length- Returns:
- array of ring elements of specified
length
-
createArray2d
Description copied from interface:Ring
Creates 2d array of ring elements of specified length- Specified by:
createArray2d
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
length
- array length- Returns:
- 2d array of ring elements of specified
length
-
createArray2d
Description copied from interface:Ring
Creates 2d array of ring elements of specified shape- Specified by:
createArray2d
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
m
- result lengthn
- length of each array in the result- Returns:
- 2d array E[m][n]
-
compare
- Specified by:
compare
in interfaceComparator<E extends IUnivariatePolynomial<E>>
-
randomElement
Description copied from interface:Ring
Returns a random element from this ring- Specified by:
randomElement
in interfaceRing<E extends IUnivariatePolynomial<E>>
- Parameters:
rnd
- the source of randomness- Returns:
- random element from this ring
-
variable
Description copied from interface:IPolynomialRing
Creates poly representing a single specified variable- Specified by:
variable
in interfaceIPolynomialRing<E extends IUnivariatePolynomial<E>>
-
parse
Description copied from interface:Ring
Parse string into ring element -
equals
- Specified by:
equals
in interfaceComparator<E extends IUnivariatePolynomial<E>>
- Overrides:
equals
in classObject
-
hashCode
public int hashCode() -
toString
Description copied from interface:Stringifiable
convert this to string with the use of stringifier- Specified by:
toString
in interfaceStringifiable<E extends IUnivariatePolynomial<E>>
-
toString
-
toString
-