Class LexComparator
java.lang.Object
com.singularsys.extensions.polynomials.comparators.LexComparator
- All Implemented Interfaces:
Comparator<PNodeI>
- Direct Known Subclasses:
GrevlexComparator,GrlexComparator
Lexical Order comparator. First orders by degree of leftmost entry. hence
quadratic monomial in 3 variables are ordered as
"x^2", // (2,0,0) "x y", // (1,1,0) "x z", // (1,0,1) "x", // (1,0,0) "y^2", // (0,2,0) "y z", // (0,1,1) "y", // (0,1,0) "z^2", // (0,0,2) "z", // (0,0,1)Those with the higher power of x first, then with highest power of y. Bracket are (deg x, deg y, deg z).
Note that variables are ordered in reverse alphabetical order so x > y > z.
See Cox, Little and O'Shea, Ideals, Varieties and Algorithms, pp57-58
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor using alphabetical orders for variables.LexComparator(PolynomialCreator pc, String[] orderedNames) Constructor with a given order for the variables -
Method Summary
Modifier and TypeMethodDescriptionintintcompare(Monomial m1, Polynomial m2) intintintintcompare(Polynomial m1, Monomial m2) intcompare(Polynomial m1, Polynomial m2) intcompare(Polynomial m1, PVariable m2) intintcompare(PVariable m1, Polynomial m2) intprotected intReturn the position in the list of ordered name, or -1 is not found.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
LexComparator
Constructor using alphabetical orders for variables. To set up usePolynomialCreator pc = new PolynomialCreator(); Comparator<PNodeI> lex = new LexComparator(pc); pc.setComparator(lex);- Parameters:
pc-
-
LexComparator
Constructor with a given order for the variables- Parameters:
pc-orderedNames-
-
-
Method Details
-
getPosition
Return the position in the list of ordered name, or -1 is not found.- Parameters:
v- variable to check- Returns:
- the position
-
compare
- Specified by:
comparein interfaceComparator<PNodeI>
-
compare
-
compare
-
compare
-
compare
-
compare
-
compare
-
compare
-
compare
-
compare
-
compare
-