Class LTMatrix
java.lang.Object
edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.BasicMatrix
edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.BasicLTMatrix
edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.LTMatrix
- Direct Known Subclasses:
SymMatrix
Implements a space-efficient Lower Triangular Matrix of elements of type
short- Author:
- Raul Saavedra (rsaavedr@ai.uwf.edu)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetDoubleValue(int r, int c) Returns element (r,c) as a doubleshortgetValue(int r, int c) Returns element (r,c)protected voidInitializes the data structure used to hold the contents of the matrixvoidAssign zero to all elements in the matrixvoidsetDoubleValue(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.voidsetValue(int r, int c, int x) Assigns integer x to matrix element (r, c).voidsetValue(int r, int c, short x) Assigns short x to matrix element (r, c)toString()Returns a specially formatted string with all the contents of this matrixMethods inherited from class edu.cmu.tetrad.study.gene.tetrad.gene.algorithm.util.BasicMatrix
badIndexXcp, getName, getSize, setName
-
Field Details
-
A
protected short[] A
-
-
Constructor Details
-
LTMatrix
Creates a lower triangular matrix withnrowsrows. -
LTMatrix
Creates a lower triangular matrix reading it from filefname.- Throws:
IOException
-
-
Method Details
-
initMatrixStorage
protected void initMatrixStorage()Initializes the data structure used to hold the contents of the matrix- Specified by:
initMatrixStoragein classBasicMatrix
-
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:
setDoubleValuein classBasicMatrix- Parameters:
r- row indexc- column indexx- 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:
getDoubleValuein classBasicMatrix- Parameters:
r- row indexc- 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:
setAllValuesToZeroin classBasicMatrix
-
toString
Returns a specially formatted string with all the contents of this matrix- Overrides:
toStringin classBasicLTMatrix- Returns:
- a specially formatted string with all the contents of this matrix
-