Package edu.jas.poly

Class IndexFactory

java.lang.Object
edu.jas.poly.IndexFactory
All Implemented Interfaces:
ElemFactory<IndexList>, MonoidFactory<IndexList>, Serializable

public class IndexFactory extends Object implements MonoidFactory<IndexList>
IndexList factory implements a factory for index lists for exterior polynomials. Objects of this class are intended to be immutable. If in doubt use valueOf to get a conformant index list.
See Also:
  • Field Details

    • imaxlength

      public final int imaxlength
      The maximal length index list for this factory.
    • vname

      public final String vname
      The coordinate variable name.
    • imax

      public final IndexList imax
      The maximal index list for this factory.
    • weak

      final boolean weak
      Defined index list comparison. Strong compare: false, weak compare: true.
    • random

      private static final Random random
      Random number generator.
    • logger

      private static final org.apache.logging.log4j.Logger logger
      Log4j logger object.
    • ONE

      public final IndexList ONE
      The one element index list.
    • DEFAULT_VNAME

      public static final String DEFAULT_VNAME
      The default coordinate variable name.
      See Also:
    • DEFAULT_SIZE

      public static final int DEFAULT_SIZE
      The default imaxlength for this index lists.
      See Also:
    • horder

      private final IndexFactory.IndexListComparator horder
      Defined descending order comparator. Sorts the highest terms first.
    • lorder

      private final IndexFactory.IndexListComparator lorder
      Defined ascending order comparator. Sorts the lowest terms first.
    • hweak

      private final IndexFactory.IndexListComparator hweak
      Defined descending weak order comparator. Sorts the highest terms first.
    • lweak

      private final IndexFactory.IndexListComparator lweak
      Defined ascending weak order comparator. Sorts the lowest terms first.
  • Constructor Details

    • IndexFactory

      public IndexFactory()
      Constructor for IndexFactory. No argument constructor .
    • IndexFactory

      public IndexFactory(int r)
      Constructor for IndexFactory.
      Parameters:
      r - length of index lists, starting with index 1.
    • IndexFactory

      public IndexFactory(int r, boolean w)
      Constructor for IndexFactory.
      Parameters:
      r - length of index lists, starting with index 1.
      w - termorder for index lists: true for weak, false for strong.
    • IndexFactory

      public IndexFactory(int r, String v)
      Constructor for IndexFactory.
      Parameters:
      r - length of index lists, starting with index 1.
      v - coordinate vname.
    • IndexFactory

      public IndexFactory(int r, String v, boolean w)
      Constructor for IndexFactory.
      Parameters:
      r - length of index lists, starting with index 1.
      v - coordinate vname.
      w - termorder for index lists: true for weak, false for strong.
    • IndexFactory

      public IndexFactory(int s, int t)
      Constructor for IndexFactory.
      Parameters:
      s - start index.
      t - length of index lists.
    • IndexFactory

      public IndexFactory(int s, int t, String v, boolean w)
      Constructor for IndexFactory.
      Parameters:
      s - start index.
      t - length of index lists.
      v - coordinate vname.
      w - termorder for index lists: true for weak, false for strong.
  • Method Details

    • isFinite

      public boolean isFinite()
      Is this structure finite or infinite.
      Specified by:
      isFinite in interface ElemFactory<IndexList>
      Returns:
      true if this structure is finite, else false.
      See Also:
    • isCommutative

      public boolean isCommutative()
      Query if this monoid is commutative.
      Specified by:
      isCommutative in interface MonoidFactory<IndexList>
      Returns:
      true if this monoid is commutative, else false.
    • isAssociative

      public boolean isAssociative()
      Query if this monoid is associative.
      Specified by:
      isAssociative in interface MonoidFactory<IndexList>
      Returns:
      true if this monoid is associative, else false.
    • fromInteger

      public IndexList fromInteger(long a)
      Get the Element for a.
      Specified by:
      fromInteger in interface ElemFactory<IndexList>
      Parameters:
      a - long
      Returns:
      element corresponding to a.
    • fromInteger

      public IndexList fromInteger(BigInteger a)
      Get the Element for a.
      Specified by:
      fromInteger in interface ElemFactory<IndexList>
      Parameters:
      a - java.math.BigInteger.
      Returns:
      element corresponding to a.
    • valueOf

      public IndexList valueOf(ExpVector e)
      Value of other.
      Parameters:
      e - other ExpVector.
      Returns:
      value as IndexList.
    • valueOf

      public IndexList valueOf(String var)
      Value of other.
      Specified by:
      valueOf in interface ElemFactory<IndexList>
      Parameters:
      var - String of index names.
      Returns:
      value as IndexList.
    • valueOf

      public IndexList valueOf(Collection<Integer> e)
      Value of other.
      Parameters:
      e - other Collection of Integer indexes.
      Returns:
      value as IndexList.
    • valueOf

      public IndexList valueOf(int[] e)
      Value of other.
      Parameters:
      e - other int[] of indexes, may not be conform to IndexList specification.
      Returns:
      value as IndexList.
    • valueOf

      public IndexList valueOf(IndexList e)
      Value of other.
      Parameters:
      e - other IndexList, may not be conform to IndexList specification.
      Returns:
      value as IndexList.
    • generators

      public List<IndexList> generators()
      Generators.
      Specified by:
      generators in interface ElemFactory<IndexList>
      Returns:
      list of generators for this index list.
    • copy

      public IndexList copy(IndexList o)
      Clone IndexList.
      Specified by:
      copy in interface ElemFactory<IndexList>
      Parameters:
      o -
      Returns:
      a copy of c.
      See Also:
    • length

      public int length()
      Get the maximal length of index lists of this factory.
      Returns:
      imaxlength.
    • 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 ElemFactory<IndexList>
      Returns:
      script compatible representation for this Element.
      See Also:
    • parse

      public IndexList parse(String s) throws NumberFormatException
      Parser for IndexList. Converts a String representation to an IndexList. Accepted format = E(1,2,3,4,5,6,7).
      Specified by:
      parse in interface ElemFactory<IndexList>
      Parameters:
      s - String representation.
      Returns:
      parsed IndexList
      Throws:
      NumberFormatException
    • parse

      public IndexList parse(Reader r)
      Parse from Reader. White space is delimiter for index list.
      Specified by:
      parse in interface ElemFactory<IndexList>
      Parameters:
      r - Reader.
      Returns:
      the next Element found on r.
    • equals

      public boolean equals(Object B)
      Comparison with any other object.
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      hashCode. Optimized for small indexes, i.e. ≤ 24 and small number of variables, i.e. ≤ 8.
      Overrides:
      hashCode in class Object
      See Also:
    • getZERO

      public IndexList getZERO()
      Get IndexList zero.
      Returns:
      0 IndexList.
    • getONE

      public IndexList getONE()
      Get IndexList one.
      Specified by:
      getONE in interface MonoidFactory<IndexList>
      Returns:
      1 IndexList.
    • random

      public final IndexList random(int r)
      Generate a random IndexList.
      Specified by:
      random in interface ElemFactory<IndexList>
      Parameters:
      r - length of new IndexList.
      Returns:
      random IndexList.
    • random

      public final IndexList random(int r, Random rnd)
      Generate a random IndexList.
      Specified by:
      random in interface ElemFactory<IndexList>
      Parameters:
      r - length of new IndexList.
      rnd - is a source for random bits.
      Returns:
      random IndexList.
    • random

      public final IndexList random(int r, float q)
      Generate a random IndexList.
      Parameters:
      r - length of new IndexList.
      q - density of nozero indexes.
      Returns:
      random IndexList.
    • random

      public final IndexList random(int r, float q, Random rnd)
      Generate a random IndexList.
      Parameters:
      r - length of new IndexList.
      q - density of nozero indexes.
      rnd - is a source for random bits.
      Returns:
      random IndexList.
    • sequence

      public final IndexList sequence(int s, int r)
      Generate a sequence IndexList.
      Parameters:
      s - starting index.
      r - length of new IndexList.
      Returns:
      sequence (s, s+1, ..., s+r-1) IndexList.
    • sequenceArray

      public static int[] sequenceArray(int s, int r)
      Generate a sequence array.
      Parameters:
      s - starting index.
      r - length of array.
      Returns:
      sequence (s, s+1, ..., s+r-1) array.
    • getDescendComparator

      public IndexFactory.IndexListComparator getDescendComparator()
      Get the descending order comparator. Sorts the highest terms first.
      Returns:
      horder.
    • getAscendComparator

      public IndexFactory.IndexListComparator getAscendComparator()
      Get the ascending order comparator. Sorts the lowest terms first.
      Returns:
      lorder.