Class GenMatrixRing<C extends RingElem<C>>

java.lang.Object
edu.jas.vector.GenMatrixRing<C>
All Implemented Interfaces:
AbelianGroupFactory<GenMatrix<C>>, AlgebraFactory<GenMatrix<C>,C>, ElemFactory<GenMatrix<C>>, MonoidFactory<GenMatrix<C>>, RingFactory<GenMatrix<C>>, Serializable

public class GenMatrixRing<C extends RingElem<C>> extends Object implements AlgebraFactory<GenMatrix<C>,C>
GenMatrixRing implements a generic matrix algebra factory with RingFactory. Matrices of n rows and m columns over C.
See Also:
  • Field Details

  • Constructor Details

    • GenMatrixRing

      public GenMatrixRing(RingFactory<C> b, int r, int c)
      Constructors for GenMatrixRing.
      Parameters:
      b - coefficient factory.
      r - number of rows.
      c - number of columns.
    • GenMatrixRing

      public GenMatrixRing(RingFactory<C> b, int r, int c, int s)
      Constructors for GenMatrixRing.
      Parameters:
      b - coefficient factory.
      r - number of rows.
      c - number of columns.
      s - block size for blocked operations.
  • Method Details

    • toString

      public String toString()
      Get the String representation as RingElem.
      Overrides:
      toString in class Object
      See Also:
    • toScript

      public String toScript()
      Get a scripting compatible string representation.
      Specified by:
      toScript in interface ElemFactory<C extends RingElem<C>>
      Returns:
      script compatible representation for this ElemFactory.
      See Also:
    • getZERO

      public GenMatrix<C> getZERO()
      Get the constant one for the GenMatrix.
      Specified by:
      getZERO in interface AbelianGroupFactory<C extends RingElem<C>>
      Returns:
      ZERO.
    • getONE

      public GenMatrix<C> getONE()
      Get the constant one for the GenMatrix.
      Specified by:
      getONE in interface MonoidFactory<C extends RingElem<C>>
      Returns:
      1.
    • generators

      public List<GenMatrix<C>> generators()
      Get a list of the generating elements.
      Specified by:
      generators in interface ElemFactory<C extends RingElem<C>>
      Returns:
      list of generators for the algebraic structure.
      See Also:
    • isFinite

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

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

      public int hashCode()
      Hash code for this matrix ring.
      Overrides:
      hashCode in class Object
      See Also:
    • isField

      public boolean isField()
      Query if this ring is a field. May return false if it is to hard to determine if this ring is a field.
      Specified by:
      isField in interface RingFactory<C extends RingElem<C>>
      Returns:
      true if it is known that this ring is a field, else false.
    • isCommutative

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

      public boolean isAssociative()
      Query if this ring is associative.
      Specified by:
      isAssociative in interface MonoidFactory<C extends RingElem<C>>
      Returns:
      true if this monoid is associative, else false.
    • characteristic

      public BigInteger characteristic()
      Characteristic of this ring.
      Specified by:
      characteristic in interface RingFactory<C extends RingElem<C>>
      Returns:
      characteristic of this ring.
    • transpose

      public GenMatrixRing<C> transpose()
      Transposed matrix ring.
      Returns:
      transposed ring factory.
    • product

      public GenMatrixRing<C> product(GenMatrixRing<C> other)
      Product matrix ring for multiplication.
      Parameters:
      other - matrix ring factory.
      Returns:
      product ring factory.
    • stack

      public GenMatrixRing<C> stack(GenMatrixRing<C> other)
      Stack matrix ring. this on top of other.
      Parameters:
      other - matrix ring factory.
      Returns:
      stack ring factory.
    • concat

      public GenMatrixRing<C> concat(GenMatrixRing<C> other)
      Concat matrix ring. this before of other.
      Parameters:
      other - matrix ring factory.
      Returns:
      concat ring factory.
    • fromInteger

      public GenMatrix<C> fromInteger(long a)
      Get the matrix for a.
      Specified by:
      fromInteger in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      a - long
      Returns:
      matrix corresponding to a.
    • fromInteger

      public GenMatrix<C> fromInteger(BigInteger a)
      Get the matrix for a.
      Specified by:
      fromInteger in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      a - long
      Returns:
      matrix corresponding to a.
    • fromList

      public GenMatrix<C> fromList(List<List<C>> om)
      From List of coefficients.
      Specified by:
      fromList in interface AlgebraFactory<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      om - list of list of coefficients.
      Returns:
      a matrix with the elements from m.
    • fromVectors

      public GenMatrix<C> fromVectors(List<GenVector<C>> om)
      From List of GenVectors.
      Parameters:
      om - list of GenVectors.
    • random

      public GenMatrix<C> random(int k)
      Random matrix.
      Specified by:
      random in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      k - size of random coefficients.
      Returns:
      a random element.
    • random

      public GenMatrix<C> random(int k, float q)
      Random matrix.
      Specified by:
      random in interface AlgebraFactory<GenMatrix<C extends RingElem<C>>,C extends RingElem<C>>
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
      Returns:
      a random matrix.
    • random

      public GenMatrix<C> random(int k, Random random)
      Random matrix.
      Specified by:
      random in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      k - size of random coefficients.
      random - is a source for random bits.
      Returns:
      a random element.
    • random

      public GenMatrix<C> random(int k, float q, Random random)
      Random matrix.
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
      random - is a source for random bits.
      Returns:
      a random element.
    • randomUpper

      public GenMatrix<C> randomUpper(int k, float q)
      Random upper triangular matrix.
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
    • randomUpper

      public GenMatrix<C> randomUpper(int k, float q, Random random)
      Random upper triangular matrix.
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
      random - is a source for random bits.
      Returns:
      a random element.
    • randomLower

      public GenMatrix<C> randomLower(int k, float q)
      Random lower triangular matrix.
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
    • randomLower

      public GenMatrix<C> randomLower(int k, float q, Random random)
      Random lower triangular matrix.
      Parameters:
      k - size of random coefficients.
      q - density of nozero coefficients.
      random - is a source for random bits.
      Returns:
      a random element.
    • copy

      public GenMatrix<C> copy(GenMatrix<C> c)
      Copy matrix.
      Specified by:
      copy in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      c - matrix to copy.
      Returns:
      copy of the matrix
    • generate

      public GenMatrix<C> generate(BiFunction<Integer,Integer,C> gener)
      Generate matrix via lambda expression.
      Parameters:
      gener - lambda expression.
      Returns:
      the generated matrix.
    • parse

      public GenMatrix<C> parse(String s)
      Parse a matrix from a String. Syntax: [ [ c, ..., c ], ..., [ c, ..., c ] ]
      Specified by:
      parse in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      s - input String.
      Returns:
      parsed matrix
    • parse

      public GenMatrix<C> parse(Reader r)
      Parse a matrix from a Reader.
      Specified by:
      parse in interface ElemFactory<C extends RingElem<C>>
      Parameters:
      r - Reader.
      Returns:
      parsed matrix