Package edu.jas.poly

Class 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 use valueOf to get a conformant index list.
    Author:
    Heinz Kredel
    See Also:
    "masnc.DIPE.mi#ILEXPR from SAC2/MAS", Serialized Form
    • Field Detail

      • val

        public final int[] val
        Representation of index list as int arrays.
      • sign

        public int sign
        Sign of index list.
    • 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

      • isConformant

        public boolean isConformant()
        Check for IndexList conformant specification.
        Returns:
        true if this a a conformant IndexList, else false.
      • copy

        public IndexList copy()
        Clone this.
        Specified by:
        copy in interface Element<IndexList>
        Returns:
        Creates and returns a copy of this Element.
        See Also:
        Object.clone()
      • 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 - position
        e - 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 class java.lang.Object
        See Also:
        Object.toString()
      • equals

        public boolean equals​(java.lang.Object B)
        Comparison with any other object.
        Specified by:
        equals in interface Element<IndexList>
        Overrides:
        equals in class java.lang.Object
        Returns:
        true if this is equal to b, else false.
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        hashCode. Optimized for small indexes, i.e. ≤ 24 and small number of variables, i.e. ≤ 8.
        Specified by:
        hashCode in interface Element<IndexList>
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hashCode.
        See Also:
        Object.hashCode()
      • 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 interface MonoidElem<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 interface MonoidElem<IndexList>
        Returns:
        If this is a unit then true is returned, else false.
      • abs

        public IndexList abs()
        IndexList absolute value.
        Returns:
        abs(this).
      • exteriorProduct

        public IndexList exteriorProduct​(IndexList V)
        IndexList exterior product. Also called wegde 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.
      • divide

        public IndexList divide​(IndexList V)
        IndexList divide. Note: experimental.
        Specified by:
        divide in interface MonoidElem<IndexList>
        Parameters:
        V - other IndexList.
        Returns:
        this/V. Note: computed as interiorRightProduct, eventually 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.
      • compareTo

        public int compareTo​(IndexList V)
        IndexList compareTo.
        Specified by:
        compareTo in interface java.lang.Comparable<IndexList>
        Specified by:
        compareTo in interface Element<IndexList>
        Parameters:
        V - other index list
        Returns:
        0 if U == V, -1 if U < V, 1 if U > V.
      • 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.