Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## baseCode.io.reader
Class SparseRaggedDouble2DNamedMatrixReader

    java.lang.Object
      baseCode.io.reader.AbstractNamedMatrixReader
          baseCode.io.reader.SparseRaggedDouble2DNamedMatrixReader

public class SparseRaggedDouble2DNamedMatrixReader
extends AbstractNamedMatrixReader

Best data structure for reading really big, really sparse matrices when a matrix represetation is needed. *

The standard format looks like this:

                                             2          <--- number of items - the first line of the file only. NOTE - this line is often blank or not present.
                                             1 2        <--- items 1 has 2 edges
                                             1 2        <--- edge indices are to items 1 & 2
                                             0.1 100    <--- with the following weights
                                             2 2        <--- items 2 also has 2 edges
                                             1 2        <--- edge indices are also to items 1 & 2 (fully connected)
                                             100 0.1    <--- with the following weights

Copyright (c) 2004 Columbia University

Version:
  $Id: SparseRaggedDouble2DNamedMatrixReader.java,v 1.22 2005/01/05 02:01:02 pavlidis Exp $
Author:
  pavlidis

Field Summary

Fields inherited from class baseCode.io.reader.AbstractNamedMatrixReader
`log`

Constructor Summary
`SparseRaggedDouble2DNamedMatrixReader()`

Method Summary
`NamedMatrix` | `read(java.io.InputStream stream)` Read an entire sparse matrix from a stream (JW format).
`NamedMatrix` | `read(java.io.InputStream stream, int offset)` Read an entire sparse matrix from a stream (JW format).
`NamedMatrix` | `read(java.lang.String fileName)`
`NamedMatrix` | `readFromAdjList(java.io.InputStream stream)`
`NamedMatrix` | `readFromAdjList(java.lang.String fileName)` Read a sparse symmetric square matrix that is expressed as an adjacency list in a tab-delimited file:
`NamedMatrix` | `readOneRow(java.io.BufferedReader dis)`
`NamedMatrix` | `readOneRow(java.io.BufferedReader dis, int offset)` Use this to read one row from a matrix (JW format).

Methods inherited from class baseCode.io.reader.AbstractNamedMatrixReader
`readHeader`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SparseRaggedDouble2DNamedMatrixReader

    public SparseRaggedDouble2DNamedMatrixReader()

Method Detail

### readFromAdjList

    public NamedMatrix readFromAdjList(java.lang.String fileName)
                                throws java.io.IOException

  Read a sparse symmetric square matrix that is expressed as an adjacency list in a tab-delimited file:

                                 item1 item2 weight
                                 item1 item5 weight

  IMPORTANT: By definition the resulting matrix is square and symmetric, even if the symmetric edges are not explicitly listed.

  Returns:
  Throws:
    `java.io.IOException`

### readFromAdjList

    public NamedMatrix readFromAdjList(java.io.InputStream stream)
                                throws java.lang.NumberFormatException,
                                       java.io.IOException

  Parameters:
    `stream` -
  Returns:
  Throws:
    `java.io.IOException`
    `java.lang.NumberFormatException` - Read a sparse symmetric square matrix that is expressed as an adjacency list in a tab-delimited file:

                      item1 item2 weight
                      item1 item5 weight

    IMPORTANT: By definition the resulting matrix is square and symmetric, even if the symmetric edges are not explicitly listed.

### read

    public NamedMatrix read(java.lang.String fileName)
                     throws java.io.IOException

  Specified by:
    `read` in class `AbstractNamedMatrixReader`
  Throws:
    `java.io.IOException`

### readOneRow

    public NamedMatrix readOneRow(java.io.BufferedReader dis)
                           throws java.io.IOException

  Specified by:
    `readOneRow` in class `AbstractNamedMatrixReader`
  Throws:
    `java.io.IOException`

### readOneRow

    public NamedMatrix readOneRow(java.io.BufferedReader dis,
                                  int offset)
                           throws java.io.IOException

  Use this to read one row from a matrix (JW format). It does not close the reader. (this actually has to read several lines to get the data for one matrix row)

  Parameters:
    `offset` - A value indicating the lowest value for the indexes listed. This is here in case the indexes in the stream are numbered starting from 1 instead of zero.
  Returns:
    @throws IOException
  Throws:
    `java.io.IOException`

### read

    public NamedMatrix read(java.io.InputStream stream)
                     throws java.io.IOException

  Read an entire sparse matrix from a stream (JW format).

  Specified by:
    `read` in class `AbstractNamedMatrixReader`
  Parameters:
    `stream` -
  Returns:
    @throws IOException
  Throws:
    `java.io.IOException`

### read

    public NamedMatrix read(java.io.InputStream stream,
                            int offset)
                     throws java.io.IOException

  Read an entire sparse matrix from a stream (JW format).

  Parameters:
    `stream` -
    `offset` - A value indicating the lowest value for the indexes listed. This is here in case the indexes in the stream are numbered starting from 1 instead of zero.
  Returns:
    @throws IOException
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2005 Columbia University. All Rights Reserved.