Package cc.redberry.rings.poly
Class MultipleFieldExtension<Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>>
- java.lang.Object
-
- cc.redberry.rings.ImageRing<sPoly,mPoly>
-
- cc.redberry.rings.poly.MultipleFieldExtension<Term,mPoly,sPoly>
-
- All Implemented Interfaces:
IParser<mPoly>
,Stringifiable<mPoly>
,IPolynomialRing<mPoly>
,Ring<mPoly>
,Serializable
,Iterable<mPoly>
,Comparator<mPoly>
public class MultipleFieldExtension<Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>> extends ImageRing<sPoly,mPoly> implements IPolynomialRing<mPoly>
Multiple field extensionF(α_1, α_2, ..., α_N)
. Elements are represented as multivariate polynomials over(α_1, α_2, ..., α_N)
; internally all arithmetic operations are performed by switching to appropriate simple field extensionF(γ)
(accessible viagetSimpleExtension()
method) whereγ
is some primitive element (accessible viagetPrimitiveElement()
method) computed automatically. Representation of generating algebraic elementsα_i
as elements of this simple extension can be obtained viagetGeneratorRep(int)
method. Originally, generators are represented by their minimal polynomials overF(α_1, α_2, ..., α_i)
("tower" representation). To construct multiple field extensions one should use {@link #mkMultipleExtension(...)} andjoinAlgebraicElement(UnivariatePolynomial)
.
-
-
Field Summary
-
Fields inherited from class cc.redberry.rings.ImageRing
imageFunc, inverseFunc, ring
-
-
Constructor Summary
Constructors Constructor Description MultipleFieldExtension(MultipleFieldExtension<Term,mPoly,sPoly>[] tower, UnivariatePolynomial<mPoly>[] minimalPolynomialsOfGenerators, mPoly primitiveElement, sPoly[] generatorsReps, SimpleFieldExtension<sPoly> simpleExtension)
-
Method Summary
Modifier and Type Method Description mPoly
copy(mPoly element)
Makes a deep copy of the specified element (for immutable instances the same reference returned).int
degree()
Returns the degree of this filed extension (that is the degree of primitive element)boolean
equals(Object o)
mPoly[]
extendedGCD(mPoly a, mPoly b)
Returns array of[gcd(a,b), s, t]
such thats * a + t * b = gcd(a, b)
mPoly
factorial(long num)
Gives a product ofvalueOf(1) * valueOf(2) * .... * valueOf(num)
mPoly
factory()
Factory polynomialmPoly
gcd(Iterable<mPoly> elements)
Returns greatest common divisor of specified elementsmPoly
gcd(mPoly... elements)
Returns greatest common divisor of specified elementsmPoly
gcd(mPoly a, mPoly b)
Returns the greatest common divisor of two elementsUnivariatePolynomial<mPoly>
getGeneratorMinimalPoly(int iGenerator)
Returns minimal polynomial corresponding to i-th generator.sPoly
getGeneratorRep(int iGenerator)
Returns representation of i-th generator as element of simple field extension generated by primitive elementgetPrimitiveElement()
sPoly[]
getGeneratorReps()
Returns representation of generators as elements of simple field extension generated by primitive elementgetPrimitiveElement()
mPoly
getOne()
Returns unit element of this ring (one)mPoly
getPrimitiveElement()
Returns the primitive element of this multiple field extensionSimpleFieldExtension<sPoly>
getSimpleExtension()
Returns the isomorphic simple field extension generated bygetPrimitiveElement()
MultipleFieldExtension<Term,mPoly,sPoly>
getSubExtension(int i)
Returns the i-th extension from the towersPoly
getUnivariateFactory()
mPoly
getZero()
Returns zero element of this ringint
hashCode()
boolean
isOne(mPoly element)
Tests whether specified element is one (exactly)boolean
isUnit(mPoly element)
Tests whether specified element is a ring unitboolean
isZero(mPoly element)
Tests whether specified element is zeroMultipleFieldExtension<Term,mPoly,sPoly>
joinAlgebraicElement(UnivariatePolynomial<mPoly> algebraicElement)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.MultipleFieldExtension<Term,mPoly,sPoly>
joinAlgebraicElement(sPoly minimalPoly)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.MultipleFieldExtension<Term,mPoly,sPoly>
joinRedundantElement(mPoly element)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.mPoly
lcm(mPoly a, mPoly b)
Returns the least common multiple of two elementsstatic <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>>
MultipleFieldExtension<Term,mPoly,sPoly>mkMultipleExtension(SimpleFieldExtension<sPoly> ext)
static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>>
MultipleFieldExtension<Term,mPoly,sPoly>mkMultipleExtension(sPoly a)
static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>>
MultipleFieldExtension<Term,mPoly,sPoly>mkMultipleExtension(sPoly... minimalPolynomials)
Creates multiple field extensionF(α_1, α_2, ..., α_i)
whereα_i
are specified by their minimal polynomials over F.static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>>
MultipleFieldExtension<Term,mPoly,sPoly>mkSplittingField(sPoly poly)
Constructs splitting field for a given polynomial.int
nVariables()
Number of polynomial variablesint
signum(mPoly element)
Returns -1 ifelement < 0
, 0 ifelement == 0
and 1 ifelement > 0
, where comparison is specified byComparator.compare(Object, Object)
String
toString()
String
toString(IStringifier stringifier)
convert this to string with the use of stringifierString
toString(String... variables)
mPoly
valueOf(long val)
Returns ring element associated with specifiedlong
mPoly
valueOfBigInteger(BigInteger val)
Returns ring element associated with specified integermPoly
variable(int variable)
Creates poly representing a single specified variable-
Methods inherited from class cc.redberry.rings.ImageRing
abs, add, add, cardinality, characteristic, compare, decrement, divideAndRemainder, factor, factorSquareFree, image, image, increment, inverse, inverse, isEuclideanRing, isField, isPerfectPower, iterator, multiply, multiply, negate, parse, perfectPowerBase, perfectPowerExponent, pow, pow, pow, quotient, randomElement, reciprocal, remainder, subtract, valueOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
compare, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface cc.redberry.rings.poly.IPolynomialRing
mkCoder, parse
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface cc.redberry.rings.Ring
abs, add, add, addMutable, cardinality, characteristic, createArray, createArray, createArray, createArray, createArray2d, createArray2d, createZeroesArray, createZeroesArray2d, decrement, divideAndRemainder, divideExact, divideExactMutable, divideOrNull, factor, factorSquareFree, fillZeros, firstBezoutCoefficient, getNegativeOne, increment, isEuclideanRing, isField, isFinite, isFiniteField, isMinusOne, isPerfectPower, isUnitOrZero, iterator, lcm, lcm, max, min, multiply, multiply, multiply, multiply, multiplyMutable, negate, negateMutable, parse, perfectPowerBase, perfectPowerExponent, pow, pow, pow, quotient, randomElement, randomElement, randomElementTree, randomElementTree, randomNonZeroElement, reciprocal, remainder, setToValueOf, subtract, subtractMutable, valueOf, valueOf
-
-
-
-
Constructor Detail
-
MultipleFieldExtension
public MultipleFieldExtension(MultipleFieldExtension<Term,mPoly,sPoly>[] tower, UnivariatePolynomial<mPoly>[] minimalPolynomialsOfGenerators, mPoly primitiveElement, sPoly[] generatorsReps, SimpleFieldExtension<sPoly> simpleExtension)
-
-
Method Detail
-
nVariables
public int nVariables()
Description copied from interface:IPolynomialRing
Number of polynomial variables- Specified by:
nVariables
in interfaceIPolynomialRing<Term extends AMonomial<Term>>
-
factory
public mPoly factory()
Description copied from interface:IPolynomialRing
Factory polynomial- Specified by:
factory
in interfaceIPolynomialRing<Term extends AMonomial<Term>>
-
variable
public mPoly variable(int variable)
Description copied from interface:IPolynomialRing
Creates poly representing a single specified variable- Specified by:
variable
in interfaceIPolynomialRing<Term extends AMonomial<Term>>
-
getUnivariateFactory
public sPoly getUnivariateFactory()
-
getPrimitiveElement
public mPoly getPrimitiveElement()
Returns the primitive element of this multiple field extension
-
degree
public int degree()
Returns the degree of this filed extension (that is the degree of primitive element)
-
getSimpleExtension
public SimpleFieldExtension<sPoly> getSimpleExtension()
Returns the isomorphic simple field extension generated bygetPrimitiveElement()
-
getGeneratorMinimalPoly
public UnivariatePolynomial<mPoly> getGeneratorMinimalPoly(int iGenerator)
Returns minimal polynomial corresponding to i-th generator.
-
getSubExtension
public MultipleFieldExtension<Term,mPoly,sPoly> getSubExtension(int i)
Returns the i-th extension from the tower
-
getGeneratorRep
public sPoly getGeneratorRep(int iGenerator)
Returns representation of i-th generator as element of simple field extension generated by primitive elementgetPrimitiveElement()
-
getGeneratorReps
public sPoly[] getGeneratorReps()
Returns representation of generators as elements of simple field extension generated by primitive elementgetPrimitiveElement()
-
joinAlgebraicElement
public MultipleFieldExtension<Term,mPoly,sPoly> joinAlgebraicElement(UnivariatePolynomial<mPoly> algebraicElement)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.
-
joinAlgebraicElement
public MultipleFieldExtension<Term,mPoly,sPoly> joinAlgebraicElement(sPoly minimalPoly)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.
-
joinRedundantElement
public MultipleFieldExtension<Term,mPoly,sPoly> joinRedundantElement(mPoly element)
Adds algebraic element given by its minimal polynomial (not checked that it is irreducible) to this.
-
valueOf
public mPoly valueOf(long val)
Description copied from interface:Ring
Returns ring element associated with specifiedlong
-
valueOfBigInteger
public mPoly valueOfBigInteger(BigInteger val)
Description copied from interface:Ring
Returns ring element associated with specified integer- Specified by:
valueOfBigInteger
in interfaceRing<Term extends AMonomial<Term>>
- Overrides:
valueOfBigInteger
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
- Parameters:
val
- integer- Returns:
- ring element associated with specified integer
-
getZero
public mPoly getZero()
Description copied from interface:Ring
Returns zero element of this ring
-
getOne
public mPoly getOne()
Description copied from interface:Ring
Returns unit element of this ring (one)
-
copy
public mPoly copy(mPoly element)
Description copied from interface:Ring
Makes a deep copy of the specified element (for immutable instances the same reference returned).
-
isZero
public boolean isZero(mPoly element)
Description copied from interface:Ring
Tests whether specified element is zero
-
isOne
public boolean isOne(mPoly element)
Description copied from interface:Ring
Tests whether specified element is one (exactly)- Specified by:
isOne
in interfaceRing<Term extends AMonomial<Term>>
- Overrides:
isOne
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
- Parameters:
element
- the ring element- Returns:
- whether specified element is exactly one
- See Also:
Ring.isUnit(Object)
-
isUnit
public boolean isUnit(mPoly element)
Description copied from interface:Ring
Tests whether specified element is a ring unit- Specified by:
isUnit
in interfaceRing<Term extends AMonomial<Term>>
- Overrides:
isUnit
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
- Parameters:
element
- the ring element- Returns:
- whether specified element is a ring unit
- See Also:
Ring.isOne(Object)
-
gcd
public mPoly gcd(mPoly a, mPoly b)
Description copied from interface:Ring
Returns the greatest common divisor of two elements
-
extendedGCD
public mPoly[] extendedGCD(mPoly a, mPoly b)
Description copied from interface:Ring
Returns array of[gcd(a,b), s, t]
such thats * a + t * b = gcd(a, b)
- Specified by:
extendedGCD
in interfaceRing<Term extends AMonomial<Term>>
- Overrides:
extendedGCD
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
-
lcm
public mPoly lcm(mPoly a, mPoly b)
Description copied from interface:Ring
Returns the least common multiple of two elements
-
gcd
public mPoly gcd(mPoly... elements)
Description copied from interface:Ring
Returns greatest common divisor of specified elements
-
gcd
public mPoly gcd(Iterable<mPoly> elements)
Description copied from interface:Ring
Returns greatest common divisor of specified elements
-
signum
public int signum(mPoly element)
Description copied from interface:Ring
Returns -1 ifelement < 0
, 0 ifelement == 0
and 1 ifelement > 0
, where comparison is specified byComparator.compare(Object, Object)
- Specified by:
signum
in interfaceIPolynomialRing<Term extends AMonomial<Term>>
- Specified by:
signum
in interfaceRing<Term extends AMonomial<Term>>
- Overrides:
signum
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
- Parameters:
element
- the element- Returns:
- -1 if
element < 0
, 0 ifelement == 0
and 1 otherwise
-
factorial
public mPoly factorial(long num)
Description copied from interface:Ring
Gives a product ofvalueOf(1) * valueOf(2) * .... * valueOf(num)
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceComparator<Term extends AMonomial<Term>>
- Overrides:
equals
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classImageRing<sPoly extends IUnivariatePolynomial<sPoly>,mPoly extends AMultivariatePolynomial<Term,mPoly>>
-
toString
public String toString(IStringifier stringifier)
Description copied from interface:Stringifiable
convert this to string with the use of stringifier- Specified by:
toString
in interfaceStringifiable<Term extends AMonomial<Term>>
-
mkMultipleExtension
public static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>> MultipleFieldExtension<Term,mPoly,sPoly> mkMultipleExtension(sPoly a)
-
mkMultipleExtension
public static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>> MultipleFieldExtension<Term,mPoly,sPoly> mkMultipleExtension(SimpleFieldExtension<sPoly> ext)
-
mkMultipleExtension
public static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>> MultipleFieldExtension<Term,mPoly,sPoly> mkMultipleExtension(sPoly... minimalPolynomials)
Creates multiple field extensionF(α_1, α_2, ..., α_i)
whereα_i
are specified by their minimal polynomials over F.NOTE: it is not tested that specified minimal polynomials are irreducible
- Parameters:
minimalPolynomials
- minimal polynomials of algebraic elements
-
mkSplittingField
public static <Term extends AMonomial<Term>,mPoly extends AMultivariatePolynomial<Term,mPoly>,sPoly extends IUnivariatePolynomial<sPoly>> MultipleFieldExtension<Term,mPoly,sPoly> mkSplittingField(sPoly poly)
Constructs splitting field for a given polynomial.
-
-