Package edu.jas.poly
Class GenPolynomialTokenizer
java.lang.Object
edu.jas.poly.GenPolynomialTokenizer
GenPolynomial Tokenizer. Used to read rational polynomials and lists of
polynomials from input streams. Arbitrary polynomial rings and coefficient
rings can be read with RingFactoryTokenizer. Note: Can no more read
QuotientRing since end of 2010, revision 3441. Quotient coefficients and
others can still be read if the respective factory is provided via the
constructor.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
private static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final boolean
private RingFactory
private static final org.apache.logging.log4j.Logger
private int
private GenPolynomialTokenizer.coeffType
private GenPolynomialTokenizer.polyType
private GenPolynomialRing
private final Reader
private GenSolvablePolynomialRing
private RelationTable
private final StreamTokenizer
private TermOrder
private String[]
-
Constructor Summary
ConstructorsConstructorDescriptionNo-args constructor reads from System.in.Constructor with Ring and Reader.Constructor with Reader. -
Method Summary
Modifier and TypeMethodDescription(package private) static boolean
digit
(char x) static String[]
Extract variable list from expression.void
Initialize coefficient and polynomial factories.void
Initialize coefficient and solvable polynomial factories.(package private) static boolean
letter
(char x) Parsing method for coefficient ring.void
Parsing method for comments.long
Parsing method for exponent (of variable).Parsing method for exterior polynomial.Parsing method for exterior polynomial.Parsing method for exterior polynomial list.Parsing method for exterior polynomial list.Parsing method for GenPolynomial.Parsing method for polynomial list.Parsing method for polynomial set.void
Parsing method for solvable polynomial relation table.Parsing method for solvable polynomial.Parsing method for solvable polynomial list.Parsing method for solvable polynomial set.Parsing method for solvable submodule list.Parsing method for solvable module set.int
Parsing method for split index.Parsing method for submodule list.Parsing method for module set.Parsing method for term order name.String[]
Parsing method for variable list.long[][]
Parsing method for weight array.long[]
Parsing method for weight list.Parsing method for word polynomial.Parsing method for word polynomial.Parsing method for word polynomial list.Parsing method for word polynomial list.static String[]
Parse variable list from String.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger logger -
debug
private static final boolean debug -
vars
-
nvars
private int nvars -
tord
-
table
-
tok
-
reader
-
fac
-
parsedCoeff
-
pfac
-
parsedPoly
-
spfac
-
-
Constructor Details
-
GenPolynomialTokenizer
public GenPolynomialTokenizer()No-args constructor reads from System.in. -
GenPolynomialTokenizer
Constructor with Ring and Reader.- Parameters:
rf
- ring factory.r
- reader stream.
-
GenPolynomialTokenizer
Constructor with Reader.- Parameters:
r
- reader stream.
-
-
Method Details
-
initFactory
Initialize coefficient and polynomial factories.- Parameters:
rf
- ring factory.ct
- coefficient type.
-
initSolvableFactory
Initialize coefficient and solvable polynomial factories.- Parameters:
rf
- ring factory.ct
- coefficient type.
-
nextPolynomial
Parsing method for GenPolynomial. Syntax depends also on the syntax of the coefficients, as the respective parser is used. Basic term/monomial syntax:... coefficient variable**exponent ... variable^exponent + ... - ....
Juxtaposition means multiplication*
. Then terms/monomials can be added or subtracted+, -
and grouped by parenthesis()
. There are some heuristics to detect when a coefficient should be parsed. To force parsing of a coefficient enclose it in braces{}
.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextExponent
Parsing method for exponent (of variable). Syntax:^long | **long
- Returns:
- the next exponent or 1.
- Throws:
IOException
-
nextComment
Parsing method for comments. Syntax:(* comment *) | /_* comment *_/
without_
. Unused, as it does not work with this pushBack().- Throws:
IOException
-
nextVariableList
Parsing method for variable list. Syntax:(a, b c, de)
gives[ "a", "b", "c", "de" ]
- Returns:
- the next variable list.
- Throws:
IOException
-
nextCoefficientRing
Parsing method for coefficient ring. Syntax:Rat | Q | Int | Z | Mod modul | Complex | C | D | Quat | AN[ (var) ( poly ) ] | AN[ modul (var) ( poly ) ] | IntFunc (var_list)
- Returns:
- the next coefficient factory.
- Throws:
IOException
-
nextWeightList
Parsing method for weight list. Syntax:(w1, w2, w3, ..., wn)
- Returns:
- the next weight list.
- Throws:
IOException
-
nextWeightArray
Parsing method for weight array. Syntax:( (w11, ...,w1n), ..., (wm1, ..., wmn) )
- Returns:
- the next weight array.
- Throws:
IOException
-
nextSplitIndex
Parsing method for split index. Syntax:|i|
- Returns:
- the next split index.
- Throws:
IOException
-
nextTermOrder
Parsing method for term order name. Syntax:L | IL | LEX | G | IG | GRLEX | W(weights) | '|'split index'|'
- Returns:
- the next term order.
- Throws:
IOException
-
nextPolynomialList
Parsing method for polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Returns:
- the next polynomial list.
- Throws:
IOException
-
nextSubModuleList
Parsing method for submodule list. Syntax:( ( p11, p12, p13, ..., p1n ), ..., ( pm1, pm2, pm3, ..., pmn ) )
- Returns:
- the next list of polynomial lists.
- Throws:
IOException
-
nextRelationTable
Parsing method for solvable polynomial relation table. Syntax:( p_1, p_2, p_3, ..., p_{n+1}, p_{n+2}, p_{n+3} )
semantics:p_{n+1} * p_{n+2} = p_{n+3}
. The next relation table is stored into the solvable polynomial factory.- Throws:
IOException
-
nextPolynomialSet
Parsing method for polynomial set. Syntax:coeffRing varList termOrderName polyList
- Returns:
- the next polynomial set.
- Throws:
IOException
-
nextSubModuleSet
Parsing method for module set. Syntax:coeffRing varList termOrderName moduleList
- Returns:
- the next module set.
- Throws:
IOException
-
nextSolvablePolynomialList
Parsing method for solvable polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Returns:
- the next solvable polynomial list.
- Throws:
IOException
-
nextSolvablePolynomial
Parsing method for solvable polynomial. Syntax: same as for polynomial. If the relation table is set-up, then multiplication will mean solvable-multiplication.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextSolvablePolynomialSet
Parsing method for solvable polynomial set. Syntax:varList termOrderName relationTable polyList
- Returns:
- the next solvable polynomial set.
- Throws:
IOException
-
nextSolvableSubModuleList
Parsing method for solvable submodule list. Syntax:( ( p11, p12, p13, ..., p1n ), ..., ( pm1, pm2, pm3, ..., pmn ) )
- Returns:
- the next list of solvable polynomial lists.
- Throws:
IOException
-
nextSolvableSubModuleSet
Parsing method for solvable module set. Syntax:varList termOrderName relationTable moduleList
- Returns:
- the next solvable module set.
- Throws:
IOException
-
nextWordPolynomial
Parsing method for word polynomial. Syntax: same as for polynomial. Multiplication will be non commutative.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextWordPolynomial
Parsing method for word polynomial. Syntax: same as for polynomial. Multiplication will be non commutative.- Parameters:
wfac
- word polynomial ring.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextWordPolynomialList
Parsing method for word polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Returns:
- the next word polynomial list.
- Throws:
IOException
-
nextWordPolynomialList
public List<GenWordPolynomial> nextWordPolynomialList(GenWordPolynomialRing wfac) throws IOException Parsing method for word polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Parameters:
wfac
- word polynomial ring.- Returns:
- the next word polynomial list.
- Throws:
IOException
-
nextExteriorPolynomial
Parsing method for exterior polynomial. Syntax: same as for polynomial. Multiplication will be non commutative.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextExteriorPolynomial
public GenExteriorPolynomial nextExteriorPolynomial(GenExteriorPolynomialRing wfac) throws IOException Parsing method for exterior polynomial. Syntax: except for index list same as for polynomial. Multiplication will be anti-commutative.- Parameters:
wfac
- exterior polynomial ring.- Returns:
- the next polynomial.
- Throws:
IOException
-
nextExteriorPolynomialList
Parsing method for exterior polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Returns:
- the next exterior polynomial list.
- Throws:
IOException
-
nextExteriorPolynomialList
public List<GenExteriorPolynomial> nextExteriorPolynomialList(GenExteriorPolynomialRing wfac) throws IOException Parsing method for exterior polynomial list. Syntax:( p1, p2, p3, ..., pn )
- Parameters:
wfac
- exterior polynomial ring.- Returns:
- the next exterior polynomial list.
- Throws:
IOException
-
digit
static boolean digit(char x) -
letter
static boolean letter(char x) -
nextComma
- Throws:
IOException
-
variableList
Parse variable list from String.- Parameters:
s
- String. Syntax:(n1,...,nk)
or(n1 ... nk)
parenthesis are optional.- Returns:
- array of variable names found in s.
-
expressionVariables
Extract variable list from expression.- Parameters:
s
- String. Syntax: any polynomial expression.- Returns:
- array of variable names found in s.
-