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

## uchicago.src.sim.network
Class AdjacencyBitMatrix

    java.lang.Object
      uchicago.src.sim.network.AbstractAdjacencyMatrix
          uchicago.src.sim.network.AdjacencyBitMatrix

All Implemented Interfaces:
  AdjacencyMatrix

    public class AdjacencyBitMatrix

extends AbstractAdjacencyMatrix

Field Summary

Fields inherited from class uchicago.src.sim.network.AbstractAdjacencyMatrix
`comment, labels, matrixLabel`

Constructor Summary
`AdjacencyBitMatrix(byte[][] m)` Constructs an AdjacencyBitMatrix from the specified two dimensional byte array.
`AdjacencyBitMatrix(int rows, int cols)` Constructs an AdjacencyBitMatrix with the specified number of rows and columns.
`AdjacencyBitMatrix(java.util.List labels)` Constructs an AdjacencyBitMatrix with the specified row/col labels.

Method Summary
`int` | `columns()` Returns the number of columns in the matrix.
`double` | `get(int row, int col)` Gets the value at row, col.
`double` | `getAvgDegree()` Gets the average degree of this matrix.
`double` | `getDensity()` Gets (computes) the density of this matrix.
`cern.colt.matrix.impl.DenseDoubleMatrix1D` | `getRow(int row)` Gets the specified row of data for this matrix.
`java.lang.String` | `matrixToString()` Returns a String representation of only the actual data matrix.
`int` | `rows()` Returns the number of rows int matrix.
`void` | `set(int row, int col, byte val)` Sets a data value in this matrix.
`void` | `set(int row, int col, double val)` Sets a data value in this matrix.
`void` | `setMatrix(byte[][] m)` Sets the matrix for this AdjacencyByteMatrix to the specified byte[][].
`void` | `setMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m)` Copies the matrix elements from the specified DenseDoubleMatrix2D.
`java.lang.String` | `toString()` Returns a String representation of this AdjacencyMatrix (comment etc.)

Methods inherited from class uchicago.src.sim.network.AbstractAdjacencyMatrix
`getComment, getLabels, getMatrixLabel, setComment, setMatrixLabel`

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

Constructor Detail

### AdjacencyBitMatrix

    public AdjacencyBitMatrix(int rows,
                              int cols)

  Constructs an AdjacencyBitMatrix with the specified number of rows and columns. The intial state of every ij is 0.

  Parameters:
    `rows` - the number of rows in the matrix
    `cols` - the number of cols in the matrix

### AdjacencyBitMatrix

    public AdjacencyBitMatrix(java.util.List labels)

  Constructs an AdjacencyBitMatrix with the specified row/col labels. The matrix row and column size are set equal to the size of the lables vector. This initial state of every ij is 0.

  Parameters:
    `labels` - the row & column labels

### AdjacencyBitMatrix

    public AdjacencyBitMatrix(byte[][] m)

  Constructs an AdjacencyBitMatrix from the specified two dimensional byte array. The matrix element at ij is set to 0 if byte[i][j] = 0, otherwise the matrix element at ij is set to 1.

  Parameters:
    `m` - the 2D byte array to construct this AdjacencyMatrix from.

Method Detail

### setMatrix

    public void setMatrix(cern.colt.matrix.impl.DenseDoubleMatrix2D m)

  Copies the matrix elements from the specified DenseDoubleMatrix2D. The matrix element at ij is set to 0 if the element at DoubleMatrix[i][j] = 0, otherwise the matrix element at ij is set to 1.

  Parameters:
    `m` - the actual matrix data for this AdjacencyMatrix

### setMatrix

    public void setMatrix(byte[][] m)

  Sets the matrix for this AdjacencyByteMatrix to the specified byte[][]. The matrix elements are copied form the specified byte[][] and any subsequent changes to that byte[][] will not be reflected in this AdjacencyBitArray.

  The matrix element at ij is set to 0 if byte[i][j] = 0, otherwise the matrix element at ij is set to 1.

  Parameters:
    `m` - the actual matrix data for this AdjacencyMatrix

### getRow

    public cern.colt.matrix.impl.DenseDoubleMatrix1D getRow(int row)

  Gets the specified row of data for this matrix.

  Parameters:
    `row` - the index of the row to get

### getDensity

    public double getDensity()

  Gets (computes) the density of this matrix.

### getAvgDegree

    public double getAvgDegree()

  Gets the average degree of this matrix.

### set

    public void set(int row,
                    int col,
                    byte val)

  Sets a data value in this matrix. If val equals the matrix element at row, col will be set to 0, otherwise it is set to 1.

  Parameters:
    `row` - the row index (i)
    `col` - the col index (j)

### set

    public void set(int row,
                    int col,
                    double val)

  Sets a data value in this matrix. If val equals the matrix element at row, col will be set to 0, otherwise it is set to 1.

  Parameters:
    `row` - the row index (i)
    `col` - the col index (j)

### get

    public double get(int row,
                      int col)

  Gets the value at row, col. This returns a double rather than a byte for implementation reasons.

  Parameters:
    `row` - the row index (i)
    `col` - the col index (j)
  Returns:
    the byte value at row, col (ij) as a double.

### rows

    public int rows()

  Returns the number of rows int matrix.

### columns

    public int columns()

  Returns the number of columns in the matrix.

### matrixToString

    public java.lang.String matrixToString()

  Returns a String representation of only the actual data matrix.

### toString

    public java.lang.String toString()

  Returns a String representation of this AdjacencyMatrix (comment etc.) together with the actual data matrix.

  Overrides:
    `toString` in class `java.lang.Object`

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