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 TypeMethodDescriptiondouble
getDoubleValue
(int r, int c) Returns element (r,c) as a doubleshort
getValue
(int r, int c) Returns element (r,c)protected void
Initializes the data structure used to hold the contents of the matrixvoid
Assign zero to all elements in the matrixvoid
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)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 withnrows
rows. -
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:
initMatrixStorage
in 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:
setDoubleValue
in 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:
getDoubleValue
in 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:
setAllValuesToZero
in classBasicMatrix
-
toString
Returns a specially formatted string with all the contents of this matrix- Overrides:
toString
in classBasicLTMatrix
- Returns:
- a specially formatted string with all the contents of this matrix
-