edu.northwestern.at.utils.math.matrix
Class DenseMatrix

java.lang.Object
  extended by edu.northwestern.at.utils.math.matrix.AbstractMatrix
      extended by edu.northwestern.at.utils.math.matrix.DenseMatrix
All Implemented Interfaces:
Matrix, java.io.Serializable

public class DenseMatrix
extends AbstractMatrix
implements Matrix

Implements a matrix as a dense two-dimensional array of doubles.

See Also:
Serialized Form

Field Summary
protected  double[][] matrixData
          The matrix contents as a two-dimensional array of doubles.
 
Fields inherited from class edu.northwestern.at.utils.math.matrix.AbstractMatrix
columns, rows
 
Constructor Summary
protected DenseMatrix()
          Don't allow instantiation without size specification.
  DenseMatrix(int rows, int columns)
          Create a matrix of the specified size.
 
Method Summary
 double get(int row, int column)
          Gets value of element at given row and column.
 void set(int row, int column, double value)
          Set an element at the given position to a new value.
 
Methods inherited from class edu.northwestern.at.utils.math.matrix.AbstractMatrix
columns, get, getColumn, getColumnData, getColumns, getColumns, getCopy, getRow, getRowData, getRows, getRows, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, rows, set, set, setColumn, setColumnData, setColumnData, setRow, setRowData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.northwestern.at.utils.math.matrix.Matrix
columns, get, getColumn, getColumnData, getColumns, getColumns, getCopy, getRow, getRowData, getRows, getRows, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, rows, set, set, setColumn, setColumnData, setColumnData, setRow, setRowData, toString
 

Field Detail

matrixData

protected double[][] matrixData
The matrix contents as a two-dimensional array of doubles.

Constructor Detail

DenseMatrix

protected DenseMatrix()
Don't allow instantiation without size specification.


DenseMatrix

public DenseMatrix(int rows,
                   int columns)
Create a matrix of the specified size.

Parameters:
rows - Number of rows.
columns - Number of columns.

Each element of the result matrix will be set to zero.

Method Detail

set

public void set(int row,
                int column,
                double value)
Set an element at the given position to a new value.

Specified by:
set in interface Matrix
Specified by:
set in class AbstractMatrix
Parameters:
row - Row in which the element occurs.
column - Column in which the element occurs.
value - The new value to be set.

get

public double get(int row,
                  int column)
Gets value of element at given row and column.

Specified by:
get in interface Matrix
Specified by:
get in class AbstractMatrix
Parameters:
row - Row in which the element occurs.
column - Column in which the element occurs.
Returns:
The value at the given position.