Package edu.jas.poly
Class IndexList
- java.lang.Object
-
- edu.jas.poly.IndexList
-
- All Implemented Interfaces:
Element<IndexList>
,MonoidElem<IndexList>
,java.io.Serializable
,java.lang.Comparable<IndexList>
public class IndexList extends java.lang.Object implements MonoidElem<IndexList>
IndexList implements index lists for exterior polynomials. Index lists are implemented as arrays of Java int type. Objects of this class are intended to be immutable, except for the sign. If in doubt usevalueOf
to get a conformant index list.- Author:
- Heinz Kredel
- See Also:
- "masnc.DIPE.mi#ILEXPR from SAC2/MAS", Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description IndexFactory
mono
Reference to IndexFactory.int
sign
Sign of index list.int[]
val
Representation of index list as int arrays.
-
Constructor Summary
Constructors Constructor Description IndexList(IndexFactory m)
Constructor for IndexList.IndexList(IndexFactory m, int[] v)
Constructor for IndexList.IndexList(IndexFactory m, int s, int[] v)
Constructor for IndexList.IndexList(IndexFactory m, java.lang.String s)
Constructor for IndexList.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IndexList
abs()
IndexList absolute value.long
bitLength()
Returns the number of bits in the representation of this index vector.int
compareTo(IndexList V)
IndexList compareTo.IndexList
copy()
Clone this.int
degree()
IndexList degree.IndexList
divide(IndexList V)
IndexList divide.boolean
divides(IndexList V)
IndexList divides test.boolean
equals(java.lang.Object B)
Comparison with any other object.IndexList
exteriorProduct(IndexList V)
IndexList exterior product.MonoidFactory<IndexList>
factory()
Get the corresponding element factory.int[]
getVal()
Get the index vector.int
getVal(int i)
Get the index at position i.int
hashCode()
hashCode.IndexList
interiorLeftProduct(IndexList V)
IndexList interior left product.IndexList
interiorRightProduct(IndexList V)
IndexList interior right product.IndexList
inverse()
IndexList inverse.boolean
isConformant()
Check for IndexList conformant specification.boolean
isONE()
Is IndexList one.boolean
isUnit()
Is IndexList a unit.boolean
isZERO()
Is IndexList zero.int
length()
Get the length of this index list.int
maxDeg()
IndexList maximal degree.int
minDeg()
IndexList minimal degree.IndexList
multiply(IndexList V)
IndexList multiply.IndexList
negate()
IndexList negate.IndexList
remainder(IndexList V)
IndexList remainder.protected int
setVal(int i, int e)
Set the index at position i to e.int
signum()
IndexList signum.int
strongCompareTo(IndexList V)
IndexList strongCompareTo.java.lang.String
toScript()
Get a scripting compatible string representation.java.lang.String
toScriptFactory()
Get a scripting compatible string representation of the factory.java.lang.String
toString()
Get the string representation.int
weakCompareTo(IndexList V)
IndexList weakCompareTo.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, quotientRemainder, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
-
-
-
Field Detail
-
val
public final int[] val
Representation of index list as int arrays.
-
sign
public int sign
Sign of index list.
-
mono
public final IndexFactory mono
Reference to IndexFactory.
-
-
Constructor Detail
-
IndexList
public IndexList(IndexFactory m)
Constructor for IndexList. No argument constructor defining 0 index list.
-
IndexList
public IndexList(IndexFactory m, int[] v)
Constructor for IndexList.- Parameters:
v
- array with indices.
-
IndexList
public IndexList(IndexFactory m, int s, int[] v)
Constructor for IndexList. Note: A copy of v is internally created.- Parameters:
s
- sign of index list.v
- array with indices.
-
IndexList
public IndexList(IndexFactory m, java.lang.String s) throws java.lang.NumberFormatException
Constructor for IndexList. Converts a String representation to an IndexList. Accepted format = E(1,2,3,4,5,6,7).- Parameters:
s
- String representation.- Throws:
java.lang.NumberFormatException
-
-
Method Detail
-
factory
public MonoidFactory<IndexList> factory()
Get the corresponding element factory.- Specified by:
factory
in interfaceElement<IndexList>
- Returns:
- factory for this Element.
- See Also:
Element.factory()
-
isConformant
public boolean isConformant()
Check for IndexList conformant specification.- Returns:
- true if this a a conformant IndexList, else false.
-
getVal
public int[] getVal()
Get the index vector.- Returns:
- val.
-
getVal
public int getVal(int i)
Get the index at position i.- Parameters:
i
- position.- Returns:
- val[i].
-
setVal
protected int setVal(int i, int e)
Set the index at position i to e.- Parameters:
i
- positione
- new index- Returns:
- old val[i].
-
length
public int length()
Get the length of this index list.- Returns:
- val.length or -1 for 0 index list.
-
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 interfaceElement<IndexList>
- Returns:
- script compatible representation for this Element.
- See Also:
Element.toScript()
-
toScriptFactory
public java.lang.String toScriptFactory()
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<IndexList>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
Element.toScriptFactory()
-
equals
public boolean equals(java.lang.Object B)
Comparison with any other object.
-
hashCode
public int hashCode()
hashCode. Optimized for small indexes, i.e. ≤ 24 and small number of variables, i.e. ≤ 8.
-
bitLength
public long bitLength()
Returns the number of bits in the representation of this index vector.- Returns:
- number of bits in the representation of this IndexList, including sign bits.
-
isZERO
public boolean isZERO()
Is IndexList zero.- Returns:
- If this sign is 0 then true is returned, else false.
-
isONE
public boolean isONE()
Is IndexList one.- Specified by:
isONE
in interfaceMonoidElem<IndexList>
- Returns:
- If this sign != 0 and length val is zero then true returned, else false.
-
isUnit
public boolean isUnit()
Is IndexList a unit.- Specified by:
isUnit
in interfaceMonoidElem<IndexList>
- Returns:
- If this is a unit then true is returned, else false.
-
exteriorProduct
public IndexList exteriorProduct(IndexList V)
IndexList exterior product. Also called wegde product.- Parameters:
V
- other index list- Returns:
- this /\ V.
-
multiply
public IndexList multiply(IndexList V)
IndexList multiply. Note: implemented by exteriorProduct.- Specified by:
multiply
in interfaceMonoidElem<IndexList>
- Parameters:
V
- other index list- Returns:
- this * V.
-
interiorLeftProduct
public IndexList interiorLeftProduct(IndexList V)
IndexList interior left product.- Parameters:
V
- other index list- Returns:
- this _| V.
-
interiorRightProduct
public IndexList interiorRightProduct(IndexList V)
IndexList interior right product.- Parameters:
V
- other index list- Returns:
- this |_ V.
-
divides
public boolean divides(IndexList V)
IndexList divides test. Test if this is contained in V.- Parameters:
V
- other index list- Returns:
- true if this divides V, else false.
-
inverse
public IndexList inverse()
IndexList inverse. Note: not implemented.- Specified by:
inverse
in interfaceMonoidElem<IndexList>
- Returns:
- 1 / this.
-
divide
public IndexList divide(IndexList V)
IndexList divide. Note: experimental.- Specified by:
divide
in interfaceMonoidElem<IndexList>
- Parameters:
V
- other IndexList.- Returns:
- this/V. Note: computed as interiorRightProduct, eventually useful.
-
remainder
public IndexList remainder(IndexList V)
IndexList remainder. Note: not implemented.- Specified by:
remainder
in interfaceMonoidElem<IndexList>
- Parameters:
V
- other IndexList.- Returns:
- this - (this/V). Note: not useful.
-
signum
public int signum()
IndexList signum.- Returns:
- sign;
-
degree
public int degree()
IndexList degree.- Returns:
- number of of all indexes.
-
maxDeg
public int maxDeg()
IndexList maximal degree.- Returns:
- maximal index.
-
minDeg
public int minDeg()
IndexList minimal degree.- Returns:
- minimal index.
-
weakCompareTo
public int weakCompareTo(IndexList V)
IndexList weakCompareTo. Ignoring the degree in first pass.- Parameters:
V
- other index list- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
strongCompareTo
public int strongCompareTo(IndexList V)
IndexList strongCompareTo. Sort by degree in first pass, then by indices.- Parameters:
V
- other index list- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
-