org.optimizationservices.oscommon.datastructure.osgeneral
Class SparseMatrix

java.lang.Object
  extended by org.optimizationservices.oscommon.datastructure.osgeneral.SparseMatrix

public class SparseMatrix
extends java.lang.Object

The SparseMatrix class holds the 3 list data structure usually used for linear constraint coefficients

Since:
OS 1.0
Version:
1.0, 03/14/2004
Author:
Robert Fourer, Jun Ma, Kipp Martin, Huanyuan Sheng

Field Summary
 int[] indexes
          indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix).
 boolean isColumnMajor
          isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column.
 int[] starts
          starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of a column (row) of nonzero elements in coefMatrix (AMatrix).
 double[] values
          values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero elements.
 
Constructor Summary
SparseMatrix()
          Default constructor.
SparseMatrix(boolean isColumnMajor, int startSize, int valueSize)
          Constructor.
 
Method Summary
 boolean display(int secondaryDim)
          This method displays data structure in the matrix format.
static void main(java.lang.String[] args)
          main for test purposes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isColumnMajor

public boolean isColumnMajor
isColumnMajor holds whether the coefMatrix (AMatrix) holding linear program data is stored by column. If false, the matrix is stored by row.


starts

public int[] starts
starts holds an integer array of start elements in coefMatrix (AMatrix), which points to the start of a column (row) of nonzero elements in coefMatrix (AMatrix).


indexes

public int[] indexes
indexes holds an integer array of rowIdx (or colIdx) elements in coefMatrix (AMatrix). If the matrix is stored by column (row), rowIdx (colIdx) is the array of row (column) indices.


values

public double[] values
values holds a double array of value elements in coefMatrix (AMatrix), which contains nonzero elements.

Constructor Detail

SparseMatrix

public SparseMatrix()
Default constructor.


SparseMatrix

public SparseMatrix(boolean isColumnMajor,
                    int startSize,
                    int valueSize)
Constructor.

Parameters:
isColumnMajor - holds whether the coefMatrix (AMatrix) holding linear program data is stored by column. If false, the matrix is stored by row.
startSize - holds the size of the start array.
valueSize - holds the size of the value and index arrays.
Method Detail

display

public boolean display(int secondaryDim)
This method displays data structure in the matrix format.

Returns:
true if display is successful

main

public static void main(java.lang.String[] args)
main for test purposes.

Parameters:
argv - command line arguments.