Parallel Colt 0.7.2

cern.colt.matrix.io
Class MatrixVectorReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by cern.colt.matrix.io.MatrixVectorReader
All Implemented Interfaces:
Closeable, Readable

public class MatrixVectorReader
extends BufferedReader

Reads matrices and vectors


Constructor Summary
MatrixVectorReader(Reader in)
          Constructor for MatrixVectorReader
MatrixVectorReader(Reader in, int sz)
          Constructor for MatrixVectorReader
 
Method Summary
 void add(int num, int[] indexes)
          Shifts the indexes.
 boolean hasInfo()
          Checks if a Matrix Market header is present ("%%MatrixMarket")
 void readArray(double[] data)
          Reads the array data
 void readArray(double[] dataR, double[] dataI)
          Reads the array data.
 void readArray(float[] data)
          Reads the array data
 void readArray(float[] dataR, float[] dataI)
          Reads the array data.
 void readArray(int[] data)
          Reads the array data
 void readArray(long[] data)
          Reads the array data
 MatrixSize readArraySize()
          Reads in the size of an array matrix.
 String[] readComments()
          Reads all the comments (lines starting with '%').
 void readCoordinate(int[] index, double[] data)
          Reads a coordinate vector
 void readCoordinate(int[] index, double[] dataR, double[] dataI)
          Reads a coordinate vector.
 void readCoordinate(int[] index, float[] data)
          Reads a coordinate vector
 void readCoordinate(int[] index, float[] dataR, float[] dataI)
          Reads a coordinate vector.
 void readCoordinate(int[] index, int[] data)
          Reads a coordinate vector
 void readCoordinate(int[] row, int[] column, double[] data)
          Reads a coordinate matrix
 void readCoordinate(int[] row, int[] column, double[] dataR, double[] dataI)
          Reads a coordinate matrix.
 void readCoordinate(int[] row, int[] column, float[] data)
          Reads a coordinate matrix
 void readCoordinate(int[] row, int[] column, float[] dataR, float[] dataI)
          Reads a coordinate matrix.
 void readCoordinate(int[] row, int[] column, int[] data)
          Reads a coordinate matrix
 void readCoordinate(int[] row, int[] column, long[] data)
          Reads a coordinate matrix
 void readCoordinate(int[] index, long[] data)
          Reads a coordinate vector
 MatrixSize readCoordinateSize()
          Reads in the size of a coordinate matrix.
 MatrixInfo readMatrixInfo()
          Reads the matrix info for the Matrix Market exchange format.
 MatrixSize readMatrixSize(MatrixInfo info)
          Reads in the size of a matrix.
 void readPattern(int[] index)
          Reads a pattern vector
 void readPattern(int[] row, int[] column)
          Reads a pattern matrix
 VectorSize readVectorArraySize()
          Reads in the size of a dense vector.
 VectorSize readVectorCoordinateSize()
          Reads in the size of a coordinate vector.
 VectorInfo readVectorInfo()
          Reads the vector info for the Matrix Market exchange format.
 VectorSize readVectorSize(VectorInfo info)
          Reads in the size of a vector.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixVectorReader

public MatrixVectorReader(Reader in)
Constructor for MatrixVectorReader

Parameters:
in - A Reader

MatrixVectorReader

public MatrixVectorReader(Reader in,
                          int sz)
Constructor for MatrixVectorReader

Parameters:
in - A Reader
sz - Input buffer size
Method Detail

add

public void add(int num,
                int[] indexes)
Shifts the indexes. Useful for converting between 0- and 1-based indicing.

Parameters:
num - Added to every index
indexes - indexes to shift

readMatrixInfo

public MatrixInfo readMatrixInfo()
                          throws IOException
Reads the matrix info for the Matrix Market exchange format. The line must consist of exactly 5 space-separated entries, the first being "%%MatrixMarket"

Throws:
IOException

readVectorInfo

public VectorInfo readVectorInfo()
                          throws IOException
Reads the vector info for the Matrix Market exchange format. The line must consist of exactly 4 space-separated entries, the first being "%%MatrixMarket"

Throws:
IOException

hasInfo

public boolean hasInfo()
                throws IOException
Checks if a Matrix Market header is present ("%%MatrixMarket")

Returns:
True if a header was found, else false
Throws:
IOException

readComments

public String[] readComments()
                      throws IOException
Reads all the comments (lines starting with '%'). Positions the reader at the first non-comment line. Can only be called after reading the matrix or vector info. The comments read does not include '%' or the newline

Throws:
IOException

readMatrixSize

public MatrixSize readMatrixSize(MatrixInfo info)
                          throws IOException
Reads in the size of a matrix. Skips initial comments

Throws:
IOException

readArraySize

public MatrixSize readArraySize()
                         throws IOException
Reads in the size of an array matrix. Skips initial comments

Throws:
IOException

readCoordinateSize

public MatrixSize readCoordinateSize()
                              throws IOException
Reads in the size of a coordinate matrix. Skips initial comments

Throws:
IOException

readVectorSize

public VectorSize readVectorSize(VectorInfo info)
                          throws IOException
Reads in the size of a vector. Skips initial comments

Throws:
IOException

readVectorArraySize

public VectorSize readVectorArraySize()
                               throws IOException
Reads in the size of a dense vector. Skips initial comments

Throws:
IOException

readVectorCoordinateSize

public VectorSize readVectorCoordinateSize()
                                    throws IOException
Reads in the size of a coordinate vector. Skips initial comments

Throws:
IOException

readArray

public void readArray(double[] data)
               throws IOException
Reads the array data

Throws:
IOException

readArray

public void readArray(float[] data)
               throws IOException
Reads the array data

Throws:
IOException

readArray

public void readArray(int[] data)
               throws IOException
Reads the array data

Throws:
IOException

readArray

public void readArray(long[] data)
               throws IOException
Reads the array data

Throws:
IOException

readArray

public void readArray(double[] dataR,
                      double[] dataI)
               throws IOException
Reads the array data. The first array will contain real entries, while the second contain imaginary entries

Throws:
IOException

readArray

public void readArray(float[] dataR,
                      float[] dataI)
               throws IOException
Reads the array data. The first array will contain real entries, while the second contain imaginary entries

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           double[] data)
                    throws IOException
Reads a coordinate vector

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           float[] data)
                    throws IOException
Reads a coordinate vector

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           int[] data)
                    throws IOException
Reads a coordinate vector

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           long[] data)
                    throws IOException
Reads a coordinate vector

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           float[] dataR,
                           float[] dataI)
                    throws IOException
Reads a coordinate vector. First data array contains real entries, and the second contains imaginary entries

Throws:
IOException

readCoordinate

public void readCoordinate(int[] index,
                           double[] dataR,
                           double[] dataI)
                    throws IOException
Reads a coordinate vector. First data array contains real entries, and the second contains imaginary entries

Throws:
IOException

readPattern

public void readPattern(int[] index)
                 throws IOException
Reads a pattern vector

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           double[] data)
                    throws IOException
Reads a coordinate matrix

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           float[] data)
                    throws IOException
Reads a coordinate matrix

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           int[] data)
                    throws IOException
Reads a coordinate matrix

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           long[] data)
                    throws IOException
Reads a coordinate matrix

Throws:
IOException

readPattern

public void readPattern(int[] row,
                        int[] column)
                 throws IOException
Reads a pattern matrix

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           double[] dataR,
                           double[] dataI)
                    throws IOException
Reads a coordinate matrix. First data array contains real entries, and the second contains imaginary entries

Throws:
IOException

readCoordinate

public void readCoordinate(int[] row,
                           int[] column,
                           float[] dataR,
                           float[] dataI)
                    throws IOException
Reads a coordinate matrix. First data array contains real entries, and the second contains imaginary entries

Throws:
IOException

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage