org.strbio.math
Class FHalfMatrix

java.lang.Object
  extended by org.strbio.math.FVector
      extended by org.strbio.math.FHalfMatrix

public class FHalfMatrix
extends FVector

like an upper triangular DMatrix. This pretends that you have a NxN matrix, but only allows access to elements in the upper triangular part (not including the diagonal). Allowed elements are of the form (i, i+1...n-1). You can access the data[] directly or call inherited methods from FVector, but you SHOULDN'T DO THIS.

Version:
1.0, 3/30/98
Author:
JMC
See Also:
DMatrix

Field Summary
 
Fields inherited from class org.strbio.math.FVector
data
 
Constructor Summary
FHalfMatrix()
          Makes a new FHalfMatrix with no data.
FHalfMatrix(FHalfMatrix x)
          This makes a FHalfMatrix from another one, making a separate copy of the data.
FHalfMatrix(int x)
          This makes a new FHalfMatrix which is the upper triangular part of a square matrix.
 
Method Summary
 int cols()
          Returns the number of columns (of the theoretical whole matrix, not just the upper triangular part.
 void load(java.io.BufferedReader fp)
          Loads from an open BufferedReader.
 void print(PrintfStream outfile)
          Print nicely formatted data to a PrintfStream.
 int rows()
          Returns the number of rows (of the theoretical whole matrix, not just the upper triangular part.
 void setValueAt(int x, int y, float d)
          This allows you to set a value at column x, row y in the theoretical whole matrix.
 float valueAt(int x, int y)
          This allows you to get a value at column x, row y in the theoretical whole matrix.
 
Methods inherited from class org.strbio.math.FVector
add, add, append, append, average, averageRW, covar, cross, cross, dimension, distance, distance, divide, divide, dot, dot, equals, findNClosest, length, linearFit, load, makeZScores, max, median, min, multiply, multiply, multiply, multiply, multiply, multiply, norm, normalize, pearson, print, reverse, reverse, save, save, setValue, setValueAt, sort, stdev, stdevp, subtract, subtract, transform, valueAt, zScore
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FHalfMatrix

public FHalfMatrix(int x)
This makes a new FHalfMatrix which is the upper triangular part of a square matrix. All elements are zero.

Parameters:
x - the number of rows and columns (x by x matrix)

FHalfMatrix

public FHalfMatrix()
Makes a new FHalfMatrix with no data. You can then load the data out of a file.


FHalfMatrix

public FHalfMatrix(FHalfMatrix x)
This makes a FHalfMatrix from another one, making a separate copy of the data.

Method Detail

rows

public final int rows()
Returns the number of rows (of the theoretical whole matrix, not just the upper triangular part.


cols

public final int cols()
Returns the number of columns (of the theoretical whole matrix, not just the upper triangular part.


valueAt

public final float valueAt(int x,
                           int y)
This allows you to get a value at column x, row y in the theoretical whole matrix. y must be greater than x, or you will probably get an ArrayOutOfBounds exception.

Parameters:
x - column number
y - row number

setValueAt

public final void setValueAt(int x,
                             int y,
                             float d)
This allows you to set a value at column x, row y in the theoretical whole matrix. y must be greater than x, or you will probably get an ArrayOutOfBounds exception.

Parameters:
x - column number
y - row number
d - float to store

print

public final void print(PrintfStream outfile)
                 throws java.io.IOException
Print nicely formatted data to a PrintfStream.

Throws:
java.io.IOException

load

public final void load(java.io.BufferedReader fp)
                throws java.io.IOException
Loads from an open BufferedReader. Other load and save functions are inherited from FVector, and work.

Overrides:
load in class FVector
Throws:
java.io.IOException
See Also:
FVector