Direct Known Subclasses:
SymMatrix

public class LTMatrix extends BasicLTMatrix
Implements a space-efficient Lower Triangular Matrix of elements of type short
Author:
Raul Saavedra (rsaavedr@ai.uwf.edu)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected short[]
     

    Fields inherited from class edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.BasicMatrix

    MAX_FLOAT, MAX_INT, MAX_SHORT, MIN_FLOAT, MIN_INT, MIN_SHORT, n, name
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a lower triangular matrix reading it from file fname.
    LTMatrix(String mname, int nrows)
    Creates a lower triangular matrix with nrows rows.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    getDoubleValue(int r, int c)
    Returns element (r,c) as a double
    short
    getValue(int r, int c)
    Returns element (r,c)
    protected void
    Initializes the data structure used to hold the contents of the matrix
    void
    Assign zero to all elements in the matrix
    void
    setDoubleValue(int r, int c, double x)
    Casts double x to short and assigns it to element (r,c) This method checks that x can be converted to a short without causing overflow.
    void
    setValue(int r, int c, int x)
    Assigns integer x to matrix element (r, c).
    void
    setValue(int r, int c, short x)
    Assigns short x to matrix element (r, c)
    Returns a specially formatted string with all the contents of this matrix

    Methods inherited from class edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.BasicMatrix

    badIndexXcp, getName, getSize, setName

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • A

      protected short[] A
  • Constructor Details

    • LTMatrix

      public LTMatrix(String mname, int nrows)
      Creates a lower triangular matrix with nrows rows.
    • LTMatrix

      public LTMatrix(String fname) throws IOException
      Creates a lower triangular matrix reading it from file fname.
      Throws:
      IOException
  • Method Details

    • initMatrixStorage

      protected void initMatrixStorage()
      Initializes the data structure used to hold the contents of the matrix
      Specified by:
      initMatrixStorage in class BasicMatrix
    • setDoubleValue

      public void setDoubleValue(int r, int c, double x)
      Casts double x to short and assigns it to element (r,c) This method checks that x can be converted to a short without causing overflow.
      Specified by:
      setDoubleValue in class BasicMatrix
      Parameters:
      r - row index
      c - column index
      x - value to be assigned to element (r,c)
    • setValue

      public void setValue(int r, int c, int x)
      Assigns integer x to matrix element (r, c). This method checks that x can be converted to a short without causing overflow.
    • setValue

      public void setValue(int r, int c, short x)
      Assigns short x to matrix element (r, c)
    • getDoubleValue

      public double getDoubleValue(int r, int c)
      Returns element (r,c) as a double
      Specified by:
      getDoubleValue in class BasicMatrix
      Parameters:
      r - row index
      c - column index
      Returns:
      the value stored at element (r,c) as a double
    • getValue

      public short getValue(int r, int c)
      Returns element (r,c)
    • setAllValuesToZero

      public void setAllValuesToZero()
      Assign zero to all elements in the matrix
      Specified by:
      setAllValuesToZero in class BasicMatrix
    • toString

      public String toString()
      Returns a specially formatted string with all the contents of this matrix
      Overrides:
      toString in class BasicLTMatrix
      Returns:
      a specially formatted string with all the contents of this matrix