drasys.or.matrix
Class Matrix

java.lang.Object
  |
  +--drasys.or.matrix.RealContainer
        |
        +--drasys.or.matrix.Matrix
Direct Known Subclasses:
ArrayMatrix, CompressedMatrix, ContiguousMatrix, ContiguousMatrix.Sub, FunctionMatrix, SparseMatrix

public abstract class Matrix
extends RealContainer
implements MatrixI, java.io.Serializable

Abstract base class for matrices.

References:

Matrix Computations (Johns Hopkins Studies in the Mathematical Sciences)
    Gene H. Golub, Charles F. Van Loan (Contributor) / Paperback / Published 1996
Numerical Recipes in C : The Art of Scientific Computing
    William H. Press, et al / Hardcover / Published 1993
Parallel Algorithms for Matrix Computations
    K.A. Gallivan / Paperback / Published 1990

See Also:
Serialized Form

Fields inherited from class drasys.or.matrix.RealContainer
_epsilon, _globalEpsilon
 
Constructor Summary
Matrix()
           
Matrix(double epsilon)
           
 
Method Summary
 java.util.Enumeration columnElements(int column)
          Returns an enumeration of the non-null elements in a column.
 java.util.Enumeration elements()
          Returns an enumeration of the non-null elements in the matrix.
 boolean equals(MatrixI matrix)
          Returns true if the matrices are numerically equal.
 boolean equals(java.lang.Object o)
           
 double[][] getArray()
          Returns a new two-dimensional array containing the values in matrix.
 java.util.Enumeration rowElements(int row)
          Returns an enumeration of the non-null elements in a row.
 void setColumn(int column, VectorI values)
          Sets the value of the elements in a column.
 void setDiagonal(VectorI values)
          Sets the value of the elements in the diagonal.
 void setElements(MatrixI values)
          Sets the value of the elements from the non-null values in 'values'.
 void setRow(int row, VectorI values)
          Sets the value of the elements in a row.
 double sum()
          Returns the sum of all of the elements in the matrix.
Computes sum(a[i][j]).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
 double sum(int begin)
          Returns the sum of all of the elements in the sub-matrix.
Computes sum(a[i][j]).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
 double sum(int rowBegin, int rowEnd, int columnBegin, int columnEnd)
          Returns the sum of the elements.
Computes sum((a[i][j]-scaler)^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
 double sumOfSquaredDifferences(double scaler)
          Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
 double sumOfSquaredDifferences(int begin, double scaler)
          Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
 double sumOfSquaredDifferences(int rowBegin, int rowEnd, int columnBegin, int columnEnd, double scaler)
          Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
 double sumOfSquares()
          Returns the sum of squares for all of the elements in the matrix.
Computes sum(a[i][j]).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
 double sumOfSquares(int begin)
          Returns the sum of the squares of all of the elements in the sub-matrix.
Computes sum(a[i][j]^2).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
 double sumOfSquares(int rowBegin, int rowEnd, int columnBegin, int columnEnd)
          Returns the sum of the squares of all of the elements in the sub-matrix.
Computes sum(a[i][j]^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
 java.lang.String toString()
           
 
Methods inherited from class drasys.or.matrix.RealContainer
equals, getEpsilon, getGlobalEpsilon, setEpsilon, setGlobalEpsilon
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix()

Matrix

public Matrix(double epsilon)
Method Detail

sum

public double sum()
Returns the sum of all of the elements in the matrix.
Computes sum(a[i][j]).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
Specified by:
sum in interface MatrixI

sumOfSquares

public double sumOfSquares()
Returns the sum of squares for all of the elements in the matrix.
Computes sum(a[i][j]).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
Specified by:
sumOfSquares in interface MatrixI

sum

public double sum(int rowBegin,
                  int rowEnd,
                  int columnBegin,
                  int columnEnd)
Returns the sum of the elements.
Computes sum((a[i][j]-scaler)^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
Specified by:
sum in interface MatrixI

sumOfSquaredDifferences

public double sumOfSquaredDifferences(int rowBegin,
                                      int rowEnd,
                                      int columnBegin,
                                      int columnEnd,
                                      double scaler)
Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
Specified by:
sumOfSquaredDifferences in interface MatrixI

getArray

public double[][] getArray()
Returns a new two-dimensional array containing the values in matrix. The rows of the array hold the rows of the matrix.
Specified by:
getArray in interface MatrixI

sumOfSquares

public double sumOfSquares(int rowBegin,
                           int rowEnd,
                           int columnBegin,
                           int columnEnd)
Returns the sum of the squares of all of the elements in the sub-matrix.
Computes sum(a[i][j]^2).
Where: i = {rowBegin,...,(rowEnd-1)}
j = {columBegin,...,(columnEnd-1)}
Specified by:
sumOfSquares in interface MatrixI

sumOfSquaredDifferences

public double sumOfSquaredDifferences(double scaler)
Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {0,...,(sizeOfRows-1)}
j = {0,...,(sizeofColumns-1)}
Specified by:
sumOfSquaredDifferences in interface MatrixI

sum

public double sum(int begin)
Returns the sum of all of the elements in the sub-matrix.
Computes sum(a[i][j]).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
Specified by:
sum in interface MatrixI

sumOfSquares

public double sumOfSquares(int begin)
Returns the sum of the squares of all of the elements in the sub-matrix.
Computes sum(a[i][j]^2).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
Specified by:
sumOfSquares in interface MatrixI

sumOfSquaredDifferences

public double sumOfSquaredDifferences(int begin,
                                      double scaler)
Returns the sum of the squared differences between the elements and a scaler.
Computes sum((a[i][j]-scaler)^2).
Where: i = {begin,...,(sizeOfRows-1)}
j = {begin,...,(sizeofColumns-1)}
Specified by:
sumOfSquaredDifferences in interface MatrixI

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

setElements

public void setElements(MatrixI values)
Sets the value of the elements from the non-null values in 'values'. Elements corresponding to null elements in 'values' are not changed.
Specified by:
setElements in interface MatrixI

setRow

public void setRow(int row,
                   VectorI values)
Sets the value of the elements in a row. Elements corresponding to null elements in 'values' are not changed.
Specified by:
setRow in interface MatrixI

setColumn

public void setColumn(int column,
                      VectorI values)
Sets the value of the elements in a column. Elements corresponding to null elements in 'values' are not changed.
Specified by:
setColumn in interface MatrixI

setDiagonal

public void setDiagonal(VectorI values)
Sets the value of the elements in the diagonal. Elements corresponding to null elements in 'values' are not changed.
Specified by:
setDiagonal in interface MatrixI

equals

public boolean equals(MatrixI matrix)
Returns true if the matrices are numerically equal. To be numerically equal the matrices must be the same size and all the elements must be equal to within this vector's 'epsilon'. All null elements have a value of zero for the comparison.
Specified by:
equals in interface MatrixI

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

rowElements

public java.util.Enumeration rowElements(int row)
Returns an enumeration of the non-null elements in a row. The elements are enumerated in random order.
Specified by:
rowElements in interface MatrixI
Returns:
an enumeration whose elements are of type MatrixElementI

columnElements

public java.util.Enumeration columnElements(int column)
Returns an enumeration of the non-null elements in a column. The elements are enumerated in random order.
Specified by:
columnElements in interface MatrixI
Returns:
an enumeration whose elements are of type MatrixElementI

elements

public java.util.Enumeration elements()
Returns an enumeration of the non-null elements in the matrix. The elements are enumerated in random order.
Specified by:
elements in interface MatrixI
Returns:
an enumeration whose elements are of type MatrixElementI


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com