drasys.or.matrix
Interface MatrixI

All Known Subinterfaces:
ContiguousMatrixI, SizableMatrixI
All Known Implementing Classes:
FunctionMatrix, Matrix

public interface MatrixI
extends RealContainerI

Abstract interface to a generic matrix.


Method Summary
 java.util.Enumeration columnElements(int column)
          Returns an enumeration of the non-null elements in a column.
 double elementAt(int row, int column)
          Gets the value of an element by its row and column index.
 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.
 double[][] getArray()
          Returns a new two-dimensional array containing the values in matrix.
 boolean isColumnMajor()
          Returns true if the matrix is column-major.
 boolean isNull(int row, int column)
          Returns true if an element has no value associated with it.
 boolean isRowMajor()
          Returns true if the matrix is row-major.
 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 setElementAt(int row, int column, double value)
          Sets the value of an element by its row and column index.
 void setElements(double value)
          Sets the value of all the non-null elements.
 void setElements(MatrixI values)
          Sets the value of the elements.
 void setRow(int row, VectorI values)
          Sets the value of the elements in a row.
 int sizeOfColumns()
          Returns the number of columns in the matrix.
 int sizeOfElements()
          Returns the number of non-null elements in the matrix.
 int sizeOfRows()
          Returns the number of rows in the matrix.
 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 all of the elements in the sub-matrix.
Computes sum(a[i][j]).
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 the squares of all of the elements in the matrix.
Computes sum(a[i][j]^2).
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)}
 
Methods inherited from interface drasys.or.matrix.RealContainerI
equals, getEpsilon, setEpsilon
 

Method Detail

isNull

public boolean isNull(int row,
                      int column)
Returns true if an element has no value associated with it. Elements which have no value assigned return 0.0 when accessed.

isRowMajor

public boolean isRowMajor()
Returns true if the matrix is row-major.

isColumnMajor

public boolean isColumnMajor()
Returns true if the matrix is column-major.

sizeOfRows

public int sizeOfRows()
Returns the number of rows in the matrix.

sizeOfColumns

public int sizeOfColumns()
Returns the number of columns in the matrix.

sizeOfElements

public int sizeOfElements()
Returns the number of non-null elements in the matrix.

setElementAt

public void setElementAt(int row,
                         int column,
                         double value)
Sets the value of an element by its row and column index.

setElements

public void setElements(double value)
Sets the value of all the non-null elements.

setElements

public void setElements(MatrixI values)
Sets the value of the elements.

setRow

public void setRow(int row,
                   VectorI values)
Sets the value of the elements in a row.

setColumn

public void setColumn(int column,
                      VectorI values)
Sets the value of the elements in a column.

setDiagonal

public void setDiagonal(VectorI values)
Sets the value of the elements in the diagonal.

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.

elementAt

public double elementAt(int row,
                        int column)
Gets the value of an element by its row and column index.
Returns:
zero is the element is null

rowElements

public java.util.Enumeration rowElements(int row)
Returns an enumeration of the non-null elements in a row. The Enumeration is free to reuse the same object for each call to 'nextElement', so the contents must be use before getting another element.
Returns:
an enumeration whose elements are mutable and of type 'MatrixElementI'

columnElements

public java.util.Enumeration columnElements(int column)
Returns an enumeration of the non-null elements in a column. The Enumeration is free to reuse the same object for each call to 'nextElement', so the contents must be use before getting another element.
Returns:
an enumeration whose elements are mutable and of type 'MatrixElementI'

elements

public java.util.Enumeration elements()
Returns an enumeration of the non-null elements in the matrix. The Enumeration is free to reuse the same object for each call to 'nextElement', so the contents must be use before getting another element.
Returns:
an enumeration whose elements are mutable and of type 'MatrixElementI'

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)}

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)}

sum

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

sumOfSquares

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

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)}

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)}

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)}

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)}

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)}

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 compare.


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