drasys.or.matrix
Class ContiguousMatrix.Sub

java.lang.Object
  |
  +--drasys.or.matrix.RealContainer
        |
        +--drasys.or.matrix.Matrix
              |
              +--drasys.or.matrix.ContiguousMatrix.Sub
Enclosing class:
ContiguousMatrix

public static class ContiguousMatrix.Sub
extends Matrix
implements ContiguousMatrixI

See Also:
Serialized Form

Fields inherited from class drasys.or.matrix.RealContainer
_epsilon, _globalEpsilon
 
Constructor Summary
ContiguousMatrix.Sub(double[] values, int m, int n, int beg, int inci, int incj)
           
 
Method Summary
 java.util.Enumeration columnElements(int column)
          Returns an enumeration of the non-null elements in a column.
 ContiguousVectorI columnVector(int column)
          Returns a reference to the column.
 ContiguousVectorI diagonalVector()
          Returns a reference to the diagonal.
 double elementAt(int row, int column)
          Returns 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.
 double[][] getArray()
          Returns a new two-dimensional array containing the values in matrix.
 int getColumnIncrement()
          Returns the distance between corresponding elements in adjacent columns.
 int getOffset(int row, int column)
          Returns an element's offset into the value array.
 int getRowIncrement()
          Returns the distance between corresponding elements in adjacent rows.
 double[] getValueArray()
          Returns the internal array that is used to hold the element values.
 boolean isColumnMajor()
          Returns true if the matrix is column-major.
 boolean isNull(int row, int column)
          Always returns false.
 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.
 ContiguousVectorI rowVector(int row)
          Returns a reference to the row.
 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.
 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.
 ContiguousMatrixI submatrix(int beginRow, int beginColumn)
          Returns a reference to the submatrix.
 ContiguousMatrixI submatrix(int beginRow, int endRow, int beginColumn, int endColumn)
          Returns a reference to the submatrix.
 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(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(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 class drasys.or.matrix.Matrix
equals, equals, setColumn, setDiagonal, setElements, setRow, sum, sum, sumOfSquaredDifferences, sumOfSquaredDifferences, sumOfSquares, sumOfSquares, 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

ContiguousMatrix.Sub

public ContiguousMatrix.Sub(double[] values,
                            int m,
                            int n,
                            int beg,
                            int inci,
                            int incj)
Method Detail

submatrix

public ContiguousMatrixI submatrix(int beginRow,
                                   int beginColumn)
Returns a reference to the submatrix.
Specified by:
submatrix in interface ContiguousMatrixI

submatrix

public ContiguousMatrixI submatrix(int beginRow,
                                   int endRow,
                                   int beginColumn,
                                   int endColumn)
Returns a reference to the submatrix.
Specified by:
submatrix in interface ContiguousMatrixI

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.
Overrides:
rowElements in class Matrix
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.
Overrides:
columnElements in class Matrix
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.
Overrides:
elements in class Matrix
Returns:
an enumeration whose elements are mutable and of type 'MatrixElementI'

setElements

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

getOffset

public int getOffset(int row,
                     int column)
Returns an element's offset into the value array.
Specified by:
getOffset in interface ContiguousMatrixI

getRowIncrement

public int getRowIncrement()
Returns the distance between corresponding elements in adjacent rows.
Specified by:
getRowIncrement in interface ContiguousMatrixI

getColumnIncrement

public int getColumnIncrement()
Returns the distance between corresponding elements in adjacent columns.
Specified by:
getColumnIncrement in interface ContiguousMatrixI

isRowMajor

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

isColumnMajor

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

getValueArray

public double[] getValueArray()
Returns the internal array that is used to hold the element values. The element values are stored in a single contiguous block of memory in this array.
Specified by:
getValueArray in interface ContiguousMatrixI

rowVector

public ContiguousVectorI rowVector(int row)
Returns a reference to the row.
Specified by:
rowVector in interface ContiguousMatrixI

columnVector

public ContiguousVectorI columnVector(int column)
Returns a reference to the column.
Specified by:
columnVector in interface ContiguousMatrixI

diagonalVector

public ContiguousVectorI diagonalVector()
Returns a reference to the diagonal.
Specified by:
diagonalVector in interface ContiguousMatrixI

isNull

public boolean isNull(int row,
                      int column)
Always returns false.

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.

elementAt

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

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.
Overrides:
getArray in class Matrix

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)}
Overrides:
sum in class Matrix

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)}
Overrides:
sumOfSquares in class Matrix

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)}
Overrides:
sumOfSquaredDifferences in class Matrix


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