Opus5
Class SparseMatrixAsLinkedList

java.lang.Object
  |
  +--Opus5.SparseMatrixAsLinkedList
All Implemented Interfaces:
Matrix, SparseMatrix

public class SparseMatrixAsLinkedList
extends java.lang.Object
implements SparseMatrix

Sparse matrix implemented using an array of linked lists.

Version:
$Id: SparseMatrixAsLinkedList.java,v 3.3 1998/07/28 03:02:23 brpreiss Exp $
Author:
Bruno R. Preiss, P.Eng.

Field Summary
protected  LinkedList[] lists
          An array of linked lists---one linked list for each row.
protected  int numberOfColumns
          The number of columns.
protected  int numberOfRows
          The number of columns.
 
Fields inherited from interface Opus5.SparseMatrix
copyright
 
Constructor Summary
SparseMatrixAsLinkedList(int numberOfRows, int numberOfColumns)
          Construct a SparseMatrixAsLinkedLists 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 datum)
          Stores the specified value in this matrix at the specified position.
 void putZero(int i, int j)
          Stores a zero 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
The number of columns.

numberOfColumns

protected int numberOfColumns
The number of columns.

lists

protected LinkedList[] lists
An array of linked lists---one linked list for each row.
Constructor Detail

SparseMatrixAsLinkedList

public SparseMatrixAsLinkedList(int numberOfRows,
                                int numberOfColumns)
Construct a SparseMatrixAsLinkedLists 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 datum)
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.

putZero

public void putZero(int i,
                    int j)
Stores a zero in this matrix at the specified position.
Specified by:
putZero in interface SparseMatrix
Parameters:
i - The row number.
j - The column number.

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. This method is not implemented.
Specified by:
times in interface Matrix
Parameters:
The - specified matrix.
Returns:
The product of this matrix and the specified matrix
Throws:
MethodNotImplemented - Always.

plus

public Matrix plus(Matrix mat)
Returns the sum of this matrix and the specified matrix. This method is not implemented.
Specified by:
plus in interface Matrix
Parameters:
The - specified matrix.
Returns:
The sum of this matrix and the specified matrix
Throws:
MethodNotImplemented - Always.