Opus5
Class DenseMatrix

java.lang.Object
  |
  +--Opus5.DenseMatrix
All Implemented Interfaces:
Matrix

public class DenseMatrix
extends java.lang.Object
implements Matrix

Dense matrix implemented using a two-dimensional array.

Version:
$Id: DenseMatrix.java,v 3.2 2000/03/26 14:53:34 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.

Field Summary
protected  double[][] array
          Two-dimensional array.
protected  int numberOfColumns
          Number of columns.
protected  int numberOfRows
          Number of rows.
 
Fields inherited from interface Opus5.Matrix
copyright
 
Constructor Summary
DenseMatrix(int numberOfRows, int numberOfColumns)
          Constructs a DenseMatrixAsArray with the specified dimensions.
 
Method Summary
 double get(int i, int j)
          Returns the value in this matrix at the specified position.
 Matrix plus(Matrix mat)
          Returns the sum of this matrix and the specified matrix.
 void put(int i, int j, double d)
          Stores the specified value in this matrix at the specified position.
 Matrix times(Matrix mat)
          Returns the product of this matrix and the specified matrix.
 Matrix transpose()
          Returns the transpose of this matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numberOfRows

protected int numberOfRows
Number of rows.

numberOfColumns

protected int numberOfColumns
Number of columns.

array

protected double[][] array
Two-dimensional array.
Constructor Detail

DenseMatrix

public DenseMatrix(int numberOfRows,
                   int numberOfColumns)
Constructs a DenseMatrixAsArray with the specified dimensions.
Parameters:
numberOfRows - The number of rows.
numberOfColumns - The number of columns.
Method Detail

get

public double get(int i,
                  int j)
Returns the value in this matrix at the specified position.
Specified by:
get in interface Matrix
Parameters:
i - The row number.
j - The column number.
Returns:
The value in this matrix at the specified position.

put

public void put(int i,
                int j,
                double d)
Stores the specified value in this matrix at the specified position.
Specified by:
put in interface Matrix
Parameters:
i - The row number.
j - The column number.
datum - The value to be stored.

transpose

public Matrix transpose()
Returns the transpose of this matrix.
Specified by:
transpose in interface Matrix
Returns:
The transpose of this matrix.

times

public Matrix times(Matrix mat)
Returns the product of this matrix and the specified matrix.
Specified by:
times in interface Matrix
Parameters:
The - specified matrix.
Returns:
The product of this matrix and the specified matrix
Throws:
java.lang.IllegalArgumentException - If the matrices are incompatible.

plus

public Matrix plus(Matrix mat)
Returns the sum of this matrix and the specified matrix.
Specified by:
plus in interface Matrix
Parameters:
The - specified matrix.
Returns:
The sum of this matrix and the specified matrix
Throws:
java.lang.IllegalArgumentException - If the matrices are incompatible.