gov.sandia.cognition.math.matrix
Class MatrixReader

java.lang.Object
  extended by gov.sandia.cognition.math.matrix.MatrixReader

@CodeReview(reviewer="Jonathan McClain",
            date="2006-05-19",
            changesNeeded=false,
            comments="Looks fine.")
public class MatrixReader
extends Object

Reads a Matrix from the specified reader. The format is an (MxN) array of doubles, WITHOUT specifying the dimensions explicitly. We determine the matrix dimensions by first reading all the rows (Vectors) of the file, then ensuring that each row (Vector) has the same dimension.

Since:
1.0
Author:
Kevin R. Dixon

Constructor Summary
MatrixReader(Reader reader)
          Creates a new instance of MatrixReader
 
Method Summary
protected  VectorReader getInternalReader()
          Getter for internalReader
 Matrix read()
          Reads the next Matrix found in the specified Reader
protected  void setInternalReader(VectorReader internalReader)
          Setter for internalReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixReader

public MatrixReader(Reader reader)
Creates a new instance of MatrixReader

Parameters:
reader - Java reader stream from which to pull the data
Method Detail

getInternalReader

protected VectorReader getInternalReader()
Getter for internalReader

Returns:
internal reader that reads a vector of numbers off of each line

setInternalReader

protected void setInternalReader(VectorReader internalReader)
Setter for internalReader

Parameters:
internalReader - internal reader that reads a vector of numbers off of each line

read

public Matrix read()
            throws IOException
Reads the next Matrix found in the specified Reader

Returns:
the next Matrix found in the specified Reader
Throws:
IOException - If an invalid reader is given, or no Matrix is found