drasys.or.matrix.complex
Class ColumnMajorMatrix

java.lang.Object
  |
  +--drasys.or.matrix.complex.ComplexContainer
        |
        +--drasys.or.matrix.complex.Matrix
              |
              +--drasys.or.matrix.complex.ContiguousMatrix
                    |
                    +--drasys.or.matrix.complex.ColumnMajorMatrix

public class ColumnMajorMatrix
extends ContiguousMatrix

A dense contiguous column-major matrix of complex values. This storage format matches the 'Fortran' language matrix format. The elements are store contiguously in a single java array. This matrix is efficient for numerical computing, especially column-wise computations. There is more information available about the internal storage format.

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

Inner classes inherited from class drasys.or.matrix.complex.ContiguousMatrix
ContiguousMatrix.Sub
 
Fields inherited from class drasys.or.matrix.complex.ComplexContainer
_epsilon, _globalEpsilon
 
Constructor Summary
ColumnMajorMatrix(double[][] array)
          Constructs a contiguous dense column-major matrix with the same number of rows as 'array'.
ColumnMajorMatrix(double[][] real, double[][] imag)
          Constructs a contiguous dense column-major matrix with the same number of rows as 'real' and 'imag'.
ColumnMajorMatrix(int sizeOfRows, int sizeOfColumns)
          Constructs a contiguous dense column-major matrix with an explicit size.
ColumnMajorMatrix(int sizeOfRows, int sizeOfColumns, int capacityOfRows, int capacityOfColumns)
          Constructs a contiguous dense column-major matrix with an explicit size and capacity.
ColumnMajorMatrix(MatrixI matrix)
          Constructs a contiguous dense column-major matrix with the same number of rows and columns as 'matrix'.
ColumnMajorMatrix(VectorI vector)
          Constructs a square matrix with the 'vector' as the diagonal and zeros.
 
Method Summary
 void addColumn(VectorI vector)
          Adds a new column and any non-null elements in vector to the end of the matrix .
 void addRow(VectorI vector)
          Adds a new row and any non-null elements in vector to the end of the matrix .
 java.util.Enumeration columnElements(int column)
          Returns an enumeration of the non-null elements in a column.
 Complex elementAt(int row, int column)
          Returns the value of an element by its row and column index.
 Complex elementAt(int row, int column, Complex results)
          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.
 boolean isColumnMajor()
          Returns true if the matrix is column-major.
 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 setCapacity(int capacityOfRows, int capacityOfColumns)
          Allocates memory so the matrix can hold this many rows and columns without reallocating memory.
 void setElementAt(int row, int column, ComplexI value)
          Sets the value of an element by its row and column index.
 void setSize(int sizeOfRows, int sizeOfColumns)
          Sets the number of rows and columns in the matrix.
 
Methods inherited from class drasys.or.matrix.complex.ContiguousMatrix
capacityOfColumns, capacityOfRows, columnVector, diagonalVector, getValueArray, isNull, rowVector, setElements, sizeOfColumns, sizeOfElements, sizeOfRows, sum, sumOfSquaredDifferences, sumOfSquares
 
Methods inherited from class drasys.or.matrix.complex.Matrix
equals, equals, setColumn, setDiagonal, setElements, setRow, sum, sum, sumOfSquaredDifferences, sumOfSquaredDifferences, sumOfSquares, sumOfSquares, toString
 
Methods inherited from class drasys.or.matrix.complex.ComplexContainer
equals, equals, getEpsilon, getGlobalEpsilon, setEpsilon, setGlobalEpsilon
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnMajorMatrix

public ColumnMajorMatrix(int sizeOfRows,
                         int sizeOfColumns)
Constructs a contiguous dense column-major matrix with an explicit size. All the elements are initialized to zero.

ColumnMajorMatrix

public ColumnMajorMatrix(int sizeOfRows,
                         int sizeOfColumns,
                         int capacityOfRows,
                         int capacityOfColumns)
Constructs a contiguous dense column-major matrix with an explicit size and capacity. All the elements are initialized to zero.

ColumnMajorMatrix

public ColumnMajorMatrix(double[][] array)
Constructs a contiguous dense column-major matrix with the same number of rows as 'array'. The number of columns will match the longest row in 'array'. Some elements can be missing from 'array' either because a row is null or too short. These elements will be set to zero in the matrix.

ColumnMajorMatrix

public ColumnMajorMatrix(double[][] real,
                         double[][] imag)
Constructs a contiguous dense column-major matrix with the same number of rows as 'real' and 'imag'. The number of columns will match the longest row in 'real' and 'imag'. Each complex element gets one component from from 'real' and one from 'imag'
EG: complex[0][0] = (real[0][0],imag[0][0])
Either 'real' or 'imag' can be null, but not both.

ColumnMajorMatrix

public ColumnMajorMatrix(MatrixI matrix)
Constructs a contiguous dense column-major matrix with the same number of rows and columns as 'matrix'. If 'matrix' is sparse, the null elements will be set to zero in the new matrix.

ColumnMajorMatrix

public ColumnMajorMatrix(VectorI vector)
Constructs a square matrix with the 'vector' as the diagonal and zeros. If 'vector' is sparse, the null elements will be set to zero in the diagonal.
Method Detail

getOffset

public int getOffset(int row,
                     int column)
Returns an element's offset into the value array.

getRowIncrement

public int getRowIncrement()
Returns the distance between corresponding elements in adjacent rows.

getColumnIncrement

public int getColumnIncrement()
Returns the distance between corresponding elements in adjacent columns.

isRowMajor

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

isColumnMajor

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

setSize

public void setSize(int sizeOfRows,
                    int sizeOfColumns)
Sets the number of rows and columns in the matrix. The value of any new elements will be initialized to zero.

setCapacity

public void setCapacity(int capacityOfRows,
                        int capacityOfColumns)
Allocates memory so the matrix can hold this many rows and columns without reallocating memory.

addRow

public void addRow(VectorI vector)
Adds a new row and any non-null elements in vector to the end of the matrix . If 'vector' is null then no new elements will be modified in the new row.

addColumn

public void addColumn(VectorI vector)
Adds a new column and any non-null elements in vector to the end of the matrix . If 'vector' is null then no new elements will be changed in the new column.

setElementAt

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

elementAt

public Complex 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

elementAt

public Complex elementAt(int row,
                         int column,
                         Complex results)
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.

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'


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