Package edu.jas.poly
Class GenWordPolynomialRing<C extends RingElem<C>>
- java.lang.Object
-
- edu.jas.poly.GenWordPolynomialRing<C>
-
- Type Parameters:
C- coefficient type
- All Implemented Interfaces:
AbelianGroupFactory<GenWordPolynomial<C>>,ElemFactory<GenWordPolynomial<C>>,MonoidFactory<GenWordPolynomial<C>>,RingFactory<GenWordPolynomial<C>>,java.io.Serializable
public final class GenWordPolynomialRing<C extends RingElem<C>> extends java.lang.Object implements RingFactory<GenWordPolynomial<C>>
GenWordPolynomialRing generic polynomial factory implementing RingFactory; Factory for non-commutative string polynomials over C.- Author:
- Heinz Kredel
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description WordFactoryalphabetThe factory for the alphabet.RingFactory<C>coFacThe factory for the coefficients.GenWordPolynomial<C>ONEThe constant polynomial 1 for this ring.WordwoneThe constant empty word exponent for this ring.GenWordPolynomial<C>ZEROThe constant polynomial 0 for this ring.
-
Constructor Summary
Constructors Constructor Description GenWordPolynomialRing(GenPolynomialRing<C> fac)The constructor creates a polynomial factory object.GenWordPolynomialRing(RingFactory<C> cf, GenWordPolynomialRing o)The constructor creates a polynomial factory object.GenWordPolynomialRing(RingFactory<C> cf, WordFactory wf)The constructor creates a polynomial factory object with the default term order.GenWordPolynomialRing(RingFactory<C> cf, java.lang.String s)The constructor creates a polynomial factory object.GenWordPolynomialRing(RingFactory<C> cf, java.lang.String[] s)The constructor creates a polynomial factory object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigIntegercharacteristic()Characteristic of this ring.java.util.List<GenWordPolynomial<C>>commute()Generate commute polynomials for all variables.java.util.List<GenWordPolynomial<C>>commute(int i)Generate commute polynomials for given variable.GenWordPolynomial<C>commute(int i, int j)Generate commute polynomial in two variables.GenWordPolynomialRing<C>copy()Copy this factory.GenWordPolynomial<C>copy(GenWordPolynomial<C> c)Copy polynomial c.booleanequals(java.lang.Object other)Comparison with any other object.GenWordPolynomialRing<C>extend(int i)Extend variables.GenWordPolynomialRing<C>extend(java.lang.String[] vn)Extend variables.GenWordPolynomial<C>fromInteger(long a)Get a (constant) GenWordPolynomial<C> element from a long value.GenWordPolynomial<C>fromInteger(java.math.BigInteger a)Get a (constant) GenWordPolynomial<C> element from a BigInteger value.java.util.List<GenWordPolynomial<C>>generators()Get a list of all generating elements.java.util.List<GenWordPolynomial<C>>getGenerators()Get the generating elements excluding the generators for the coefficient ring.GenWordPolynomial<C>getONE()Get the one element.CgetONECoefficient()Get the one element from the coefficients.java.lang.String[]getVars()Get the variable names.GenWordPolynomial<C>getZERO()Get the zero element.CgetZEROCoefficient()Get the zero element from the coefficients.inthashCode()Hash code for this polynomial ring.booleanisAssociative()Query if this ring is associative.booleanisCommutative()Query if this ring is commutative.booleanisField()Query if this ring is a field.booleanisFinite()Is this structure finite or infinite.GenWordPolynomial<C>parse(java.io.Reader r)Parse a polynomial with the use of GenWordPolynomialTokenizer.GenWordPolynomial<C>parse(java.lang.String s)Parse a polynomial with the use of GenWordPolynomialTokenizer.GenWordPolynomial<C>random(int n)Random polynomial.GenWordPolynomial<C>random(int k, int l, int d)Generate a random polynomial.GenWordPolynomial<C>random(int k, int l, int d, java.util.Random rnd)Generate a random polynomial.GenWordPolynomial<C>random(int n, java.util.Random rnd)Random polynomial.java.lang.StringtoScript()Get a scripting compatible string representation.java.lang.StringtoString()Get the String representation.GenWordPolynomial<C>univariate(int i)Generate univariate polynomial in a given variable.java.util.List<GenWordPolynomial<C>>univariateList()Generate list of univariate polynomials in all variables.GenWordPolynomial<C>valueOf(C a)Get a (constant) GenWordPolynomial<C> element from a coefficient value.GenWordPolynomial<C>valueOf(C a, ExpVector e)Get a GenWordPolynomial<C> element from a coeffcient and an ExpVector.GenWordPolynomial<C>valueOf(C a, Word e)Get a GenWordPolynomial<C> element from a coeffcient and a word.GenWordPolynomial<C>valueOf(ExpVector e)Get a GenWordPolynomial<C> element from an ExpVector.GenWordPolynomial<C>valueOf(GenPolynomial<C> a)Get a GenWordPolynomial<C> element from a GenPolynomial<C>.GenWordPolynomial<C>valueOf(GenWordPolynomial<C> a)Get a GenWordPolynomial<C> element from a GenWordPolynomial<C>.GenWordPolynomial<C>valueOf(Word e)Get a GenWordPolynomial<C> element from a word.java.util.List<GenWordPolynomial<C>>valueOf(java.util.List<GenPolynomial<C>> A)Get a list of GenWordPolynomial<C> element from a list of GenPolynomial<C>.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.ElemFactory
valueOf
-
-
-
-
Field Detail
-
coFac
public final RingFactory<C extends RingElem<C>> coFac
The factory for the coefficients.
-
alphabet
public final WordFactory alphabet
The factory for the alphabet.
-
ZERO
public final GenWordPolynomial<C extends RingElem<C>> ZERO
The constant polynomial 0 for this ring.
-
ONE
public final GenWordPolynomial<C extends RingElem<C>> ONE
The constant polynomial 1 for this ring.
-
-
Constructor Detail
-
GenWordPolynomialRing
public GenWordPolynomialRing(RingFactory<C> cf, WordFactory wf)
The constructor creates a polynomial factory object with the default term order.- Parameters:
cf- factory for coefficients of type C.wf- factory for strings.
-
GenWordPolynomialRing
public GenWordPolynomialRing(RingFactory<C> cf, java.lang.String[] s)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.s- array of variable names.
-
GenWordPolynomialRing
public GenWordPolynomialRing(RingFactory<C> cf, java.lang.String s)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.s- string of single letter variable names.
-
GenWordPolynomialRing
public GenWordPolynomialRing(RingFactory<C> cf, GenWordPolynomialRing o)
The constructor creates a polynomial factory object.- Parameters:
cf- factory for coefficients of type C.o- other polynomial ring.
-
GenWordPolynomialRing
public GenWordPolynomialRing(GenPolynomialRing<C> fac)
The constructor creates a polynomial factory object.- Parameters:
fac- polynomial ring.
-
-
Method Detail
-
copy
public GenWordPolynomialRing<C> copy()
Copy this factory.- Returns:
- a clone of this.
-
toString
public java.lang.String toString()
Get the String representation.- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScriptin interfaceElemFactory<C extends RingElem<C>>- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
extend
public GenWordPolynomialRing<C> extend(int i)
Extend variables. Used e.g. in module embedding. Extend number of variables by i.- Parameters:
i- number of variables to extend.- Returns:
- extended word polynomial ring factory.
-
extend
public GenWordPolynomialRing<C> extend(java.lang.String[] vn)
Extend variables. Extend number of variables by length(vn).- Parameters:
vn- names for extended variables.- Returns:
- extended polynomial ring factory.
-
equals
public boolean equals(java.lang.Object other)
Comparison with any other object.- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this polynomial ring.- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
getVars
public java.lang.String[] getVars()
Get the variable names.- Returns:
- vars.
-
getZEROCoefficient
public C getZEROCoefficient()
Get the zero element from the coefficients.- Returns:
- 0 as C.
-
getONECoefficient
public C getONECoefficient()
Get the one element from the coefficients.- Returns:
- 1 as C.
-
getZERO
public GenWordPolynomial<C> getZERO()
Get the zero element.- Specified by:
getZEROin interfaceAbelianGroupFactory<C extends RingElem<C>>- Returns:
- 0 as GenWordPolynomial
.
-
getONE
public GenWordPolynomial<C> getONE()
Get the one element.- Specified by:
getONEin interfaceMonoidFactory<C extends RingElem<C>>- Returns:
- 1 as GenWordPolynomial
.
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutativein interfaceMonoidFactory<C extends RingElem<C>>- Returns:
- true if this ring is commutative, else false.
-
isAssociative
public boolean isAssociative()
Query if this ring is associative.- Specified by:
isAssociativein interfaceMonoidFactory<C extends RingElem<C>>- Returns:
- true if this ring is associative, else false.
-
isFinite
public boolean isFinite()
Is this structure finite or infinite.- Specified by:
isFinitein interfaceElemFactory<C extends RingElem<C>>- Returns:
- true if this structure is finite, else false.
- See Also:
ElemFactory.isFinite()
-
isField
public boolean isField()
Query if this ring is a field.- Specified by:
isFieldin interfaceRingFactory<C extends RingElem<C>>- Returns:
- false.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristicin interfaceRingFactory<C extends RingElem<C>>- Returns:
- characteristic of this ring.
-
valueOf
public GenWordPolynomial<C> valueOf(C a)
Get a (constant) GenWordPolynomial<C> element from a coefficient value.- Parameters:
a- coefficient.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(Word e)
Get a GenWordPolynomial<C> element from a word.- Parameters:
e- word.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(ExpVector e)
Get a GenWordPolynomial<C> element from an ExpVector.- Parameters:
e- exponent vector.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(C a, Word e)
Get a GenWordPolynomial<C> element from a coeffcient and a word.- Parameters:
a- coefficient.e- word.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(C a, ExpVector e)
Get a GenWordPolynomial<C> element from a coeffcient and an ExpVector.- Parameters:
a- coefficient.e- exponent vector.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(GenPolynomial<C> a)
Get a GenWordPolynomial<C> element from a GenPolynomial<C>.- Parameters:
a- GenPolynomial.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public GenWordPolynomial<C> valueOf(GenWordPolynomial<C> a)
Get a GenWordPolynomial<C> element from a GenWordPolynomial<C>.- Parameters:
a- GenWordPolynomial.- Returns:
- a GenWordPolynomial<C>.
-
valueOf
public java.util.List<GenWordPolynomial<C>> valueOf(java.util.List<GenPolynomial<C>> A)
Get a list of GenWordPolynomial<C> element from a list of GenPolynomial<C>.- Parameters:
A- GenPolynomial list.- Returns:
- a GenWordPolynomial<C> list.
-
fromInteger
public GenWordPolynomial<C> fromInteger(long a)
Get a (constant) GenWordPolynomial<C> element from a long value.- Specified by:
fromIntegerin interfaceElemFactory<C extends RingElem<C>>- Parameters:
a- long.- Returns:
- a GenWordPolynomial<C>.
-
fromInteger
public GenWordPolynomial<C> fromInteger(java.math.BigInteger a)
Get a (constant) GenWordPolynomial<C> element from a BigInteger value.- Specified by:
fromIntegerin interfaceElemFactory<C extends RingElem<C>>- Parameters:
a- BigInteger.- Returns:
- a GenWordPolynomial<C>.
-
random
public GenWordPolynomial<C> random(int n)
Random polynomial. Generates a random polynomial.- Specified by:
randomin interfaceElemFactory<C extends RingElem<C>>- Parameters:
n- number of terms.- Returns:
- a random polynomial.
-
random
public GenWordPolynomial<C> random(int n, java.util.Random rnd)
Random polynomial. Generates a random polynomial with k = 5, l = n, d = 3.- Specified by:
randomin interfaceElemFactory<C extends RingElem<C>>- Parameters:
n- number of terms.rnd- is a source for random bits.- Returns:
- a random polynomial.
-
random
public GenWordPolynomial<C> random(int k, int l, int d)
Generate a random polynomial.- Parameters:
k- bitsize of random coefficients.l- number of terms.d- maximal length of a random word.- Returns:
- a random polynomial.
-
random
public GenWordPolynomial<C> random(int k, int l, int d, java.util.Random rnd)
Generate a random polynomial.- Parameters:
k- bitsize of random coefficients.l- number of terms.d- maximal length of a random word.rnd- is a source for random bits.- Returns:
- a random polynomial.
-
copy
public GenWordPolynomial<C> copy(GenWordPolynomial<C> c)
Copy polynomial c.- Specified by:
copyin interfaceElemFactory<C extends RingElem<C>>- Parameters:
c- polynomial to copy.- Returns:
- a copy of c.
-
parse
public GenWordPolynomial<C> parse(java.lang.String s)
Parse a polynomial with the use of GenWordPolynomialTokenizer.- Specified by:
parsein interfaceElemFactory<C extends RingElem<C>>- Parameters:
s- String.- Returns:
- GenWordPolynomial from s.
-
parse
public GenWordPolynomial<C> parse(java.io.Reader r)
Parse a polynomial with the use of GenWordPolynomialTokenizer.- Specified by:
parsein interfaceElemFactory<C extends RingElem<C>>- Parameters:
r- Reader.- Returns:
- next GenWordPolynomial from r.
-
univariate
public GenWordPolynomial<C> univariate(int i)
Generate univariate polynomial in a given variable.- Parameters:
i- the index of the variable.- Returns:
- X_i as univariate polynomial.
-
commute
public GenWordPolynomial<C> commute(int i, int j)
Generate commute polynomial in two variables.- Parameters:
i- the index of the first variable.j- the index of the second variable.- Returns:
- X_i * x_j - X_j * X_i as polynomial.
-
commute
public java.util.List<GenWordPolynomial<C>> commute(int i)
Generate commute polynomials for given variable.- Parameters:
i- the index of the variable.- Returns:
- [X_i * x_j - X_j * X_i, i != j] as list of polynomials.
-
commute
public java.util.List<GenWordPolynomial<C>> commute()
Generate commute polynomials for all variables.- Returns:
- [X_i * x_j - X_j * X_i, i != j] as list of polynomials.
-
univariateList
public java.util.List<GenWordPolynomial<C>> univariateList()
Generate list of univariate polynomials in all variables.- Returns:
- List(X_1,...,X_n) a list of univariate polynomials.
-
getGenerators
public java.util.List<GenWordPolynomial<C>> getGenerators()
Get the generating elements excluding the generators for the coefficient ring.- Returns:
- a list of generating elements for this ring.
-
generators
public java.util.List<GenWordPolynomial<C>> generators()
Get a list of all generating elements.- Specified by:
generatorsin interfaceElemFactory<C extends RingElem<C>>- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
-