Package edu.jas.poly

Class IndexList

java.lang.Object
edu.jas.poly.IndexList
All Implemented Interfaces:
Element<IndexList>, MonoidElem<IndexList>, Serializable, Comparable<IndexList>

public class IndexList extends 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.
See Also:
  • Field Details

    • 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 Details

    • 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, String s) throws 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:
      NumberFormatException
  • Method Details

    • factory

      public MonoidFactory<IndexList> factory()
      Get the corresponding element factory.
      Specified by:
      factory in interface Element<IndexList>
      Returns:
      factory for this Element.
      See Also:
    • 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:
    • 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 String toString()
      Get the string representation.
      Overrides:
      toString in class Object
      See Also:
    • toScript

      public String toScript()
      Get a scripting compatible string representation.
      Specified by:
      toScript in interface Element<IndexList>
      Returns:
      script compatible representation for this Element.
      See Also:
    • toScriptFactory

      public String toScriptFactory()
      Get a scripting compatible string representation of the factory.
      Specified by:
      toScriptFactory in interface Element<IndexList>
      Returns:
      script compatible representation for this ElemFactory.
      See Also:
    • equals

      public boolean equals(Object B)
      Comparison with any other object.
      Specified by:
      equals in interface Element<IndexList>
      Overrides:
      equals in class Object
      Parameters:
      B -
      Returns:
      true if this is equal to b, else false.
      See Also:
    • 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 Object
      Returns:
      the hashCode.
      See Also:
    • 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).
    • negate

      public IndexList negate()
      IndexList negate.
      Returns:
      -this.
    • 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 interface MonoidElem<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 interface MonoidElem<IndexList>
      Returns:
      1 / this.
    • 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.
    • remainder

      public IndexList remainder(IndexList V)
      IndexList remainder. Note: not implemented.
      Specified by:
      remainder in interface MonoidElem<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.
    • compareTo

      public int compareTo(IndexList V)
      IndexList compareTo.
      Specified by:
      compareTo in interface 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.