RePast
v. 2.0

uchicago.src.collection
Class DoubleMatrix

java.lang.Object
  |
  +--uchicago.src.collection.DoubleMatrix
All Implemented Interfaces:
BaseMatrix

public class DoubleMatrix
extends Object
implements BaseMatrix

DoubleMatrix: a matrix of doubles (and any other number).


Constructor Summary
DoubleMatrix(int sizeX, int sizeY)
          Constructs a matrix of the specified size, initializing the matrix cells to 0.
DoubleMatrix(int sizeX, int sizeY, double[] matrix)
          Constructs a matrix of the specified size, initializing the matrix cells to the values in matrix.
 
Method Summary
 DoubleMatrix copyMatrix()
           
 void copyMatrixTo(DoubleMatrix dm)
          Copies the double[] in this DoubleMatrix to the specified double matrix.
 Object get(int index)
           
 Object get(int col, int row)
           
 double[] getData()
           
 double getDoubleAt(int x, int y)
           
 int getNumCols()
           
 int getNumRows()
           
 int getSizeX()
           
 int getSizeY()
           
 void initialize(double value)
          Fills the matrix with the passed in value
 void printToFile(String fileName)
           
 void put(int col, int row, Object obj)
           
 void put(int index, Object obj)
           
 void putDoubleAt(int x, int y, double value)
           
 Object remove(int index)
           
 Object remove(int col, int row)
           
 double removeDouble(int col, int row)
          Removes the value and the specified column and row, leaving 0 in in its place.
 int size()
           
 void trim()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleMatrix

public DoubleMatrix(int sizeX,
                    int sizeY)
Constructs a matrix of the specified size, initializing the matrix cells to 0.


DoubleMatrix

public DoubleMatrix(int sizeX,
                    int sizeY,
                    double[] matrix)
Constructs a matrix of the specified size, initializing the matrix cells to the values in matrix.

Method Detail

getDoubleAt

public double getDoubleAt(int x,
                          int y)

putDoubleAt

public void putDoubleAt(int x,
                        int y,
                        double value)

copyMatrix

public DoubleMatrix copyMatrix()

copyMatrixTo

public void copyMatrixTo(DoubleMatrix dm)
Copies the double[] in this DoubleMatrix to the specified double matrix.


getSizeX

public int getSizeX()

getSizeY

public int getSizeY()

initialize

public void initialize(double value)
Fills the matrix with the passed in value

Parameters:
value - the value to fill the matrix with.

get

public Object get(int index)

get

public Object get(int col,
                  int row)
Specified by:
get in interface BaseMatrix

put

public void put(int index,
                Object obj)

put

public void put(int col,
                int row,
                Object obj)
Specified by:
put in interface BaseMatrix

remove

public Object remove(int col,
                     int row)
Specified by:
remove in interface BaseMatrix

remove

public Object remove(int index)

removeDouble

public double removeDouble(int col,
                           int row)
Removes the value and the specified column and row, leaving 0 in in its place.


size

public int size()
Specified by:
size in interface BaseMatrix

getNumRows

public int getNumRows()
Specified by:
getNumRows in interface BaseMatrix

getNumCols

public int getNumCols()
Specified by:
getNumCols in interface BaseMatrix

getData

public double[] getData()

trim

public void trim()
Specified by:
trim in interface BaseMatrix

printToFile

public void printToFile(String fileName)

RePast
v. 2.0

Bug reports and feature requests to RePast