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 WordFactory
alphabet
The factory for the alphabet.RingFactory<C>
coFac
The factory for the coefficients.GenWordPolynomial<C>
ONE
The constant polynomial 1 for this ring.Word
wone
The constant empty word exponent for this ring.GenWordPolynomial<C>
ZERO
The 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.BigInteger
characteristic()
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.boolean
equals(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.C
getONECoefficient()
Get the one element from the coefficients.java.lang.String[]
getVars()
Get the variable names.GenWordPolynomial<C>
getZERO()
Get the zero element.C
getZEROCoefficient()
Get the zero element from the coefficients.int
hashCode()
Hash code for this polynomial ring.boolean
isAssociative()
Query if this ring is associative.boolean
isCommutative()
Query if this ring is commutative.boolean
isField()
Query if this ring is a field.boolean
isFinite()
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.String
toScript()
Get a scripting compatible string representation.java.lang.String
toString()
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 coefficient and an ExpVector.GenWordPolynomial<C>
valueOf(C a, Word e)
Get a GenWordPolynomial<C> element from a coefficient 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:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
toScript
public java.lang.String toScript()
Get a scripting compatible string representation.- Specified by:
toScript
in 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:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
Hash code for this polynomial ring.- Overrides:
hashCode
in 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:
getZERO
in interfaceAbelianGroupFactory<C extends RingElem<C>>
- Returns:
- 0 as GenWordPolynomial
.
-
getONE
public GenWordPolynomial<C> getONE()
Get the one element.- Specified by:
getONE
in interfaceMonoidFactory<C extends RingElem<C>>
- Returns:
- 1 as GenWordPolynomial
.
-
isCommutative
public boolean isCommutative()
Query if this ring is commutative.- Specified by:
isCommutative
in 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:
isAssociative
in 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:
isFinite
in 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:
isField
in interfaceRingFactory<C extends RingElem<C>>
- Returns:
- false.
-
characteristic
public java.math.BigInteger characteristic()
Characteristic of this ring.- Specified by:
characteristic
in 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 coefficient 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 coefficient 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:
fromInteger
in 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:
fromInteger
in 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:
random
in 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:
random
in 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:
copy
in 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:
parse
in 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:
parse
in 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:
generators
in interfaceElemFactory<C extends RingElem<C>>
- Returns:
- list of generators for the algebraic structure.
- See Also:
ElemFactory.generators()
-
-