com.multicorebsp.util
Class ICRS<DataType extends MatrixData<DataType>>

java.lang.Object
  extended by com.multicorebsp.util.Matrix<DataType>
      extended by com.multicorebsp.util.SparseMatrix<DataType,ICRS<DataType>>
          extended by com.multicorebsp.util.ICRS<DataType>
Type Parameters:
DataType - What kind of data to store.
All Implemented Interfaces:
com.multicorebsp.core.CompulsaryCloneable<ICRS<DataType>>, java.lang.Cloneable

public class ICRS<DataType extends MatrixData<DataType>>
extends SparseMatrix<DataType,ICRS<DataType>>

Implements the Incremental CRS datastructure for sparse matrices.


Field Summary
 int[] column_increment
          Column increment array
 int[] row_increment
          Row increment array
 
Fields inherited from class com.multicorebsp.util.SparseMatrix
data, n
 
Fields inherited from class com.multicorebsp.util.Matrix
m, nz
 
Constructor Summary
  ICRS(CRS<DataType> toCopy)
          Takes a CRS type matrix, copies and transforms it into ICRS.
  ICRS(DataType data, int m, int n, int nz)
          Base constructor, creates a matrix with the given nonzero data and increment arrays zeroed out.
protected ICRS(ICRS<DataType> toCopy)
          Deep copy constructor.
  ICRS(TS<DataType> toCopy)
          Takes a TS type matrix, and copies it into ICRS format.
  ICRS(TS<DataType> toCopy, int m, int n, int lo, int hi)
          Takes a TS type matrix, and partially copies it into ICRS.
 
Method Summary
protected  void CRS2ICRS()
          Internal conversion helper function.
 void removeAndAddDuplicates()
          Removes and combines any double entries.
 ICRS<DataType> safeClone()
           
 CRS<DataType> toCRS()
          Warning: returns current matrix if this matrix already is CRS.
 ICRS<DataType> toICRS()
          Warning: returns current matrix if this matrix already is CRS.
 TS<DataType> toTS()
          Warning: returns current matrix if this matrix already is TS.
 
Methods inherited from class com.multicorebsp.util.SparseMatrix
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

row_increment

public int[] row_increment
Row increment array


column_increment

public int[] column_increment
Column increment array

Constructor Detail

ICRS

public ICRS(DataType data,
            int m,
            int n,
            int nz)
Base constructor, creates a matrix with the given nonzero data and increment arrays zeroed out.

Parameters:
data - Where to store matrix data.
m - Number of rows in matrix.
n - Number of columns in matrix.
nz - Number of nonzeroes in matrix.

ICRS

public ICRS(CRS<DataType> toCopy)
Takes a CRS type matrix, copies and transforms it into ICRS.

Parameters:
toCopy - The matrix to copy.

ICRS

public ICRS(TS<DataType> toCopy)
Takes a TS type matrix, and copies it into ICRS format. Warning: sorts the TS matrix to CRS form first!

Parameters:
toCopy - The matrix to copy.

ICRS

public ICRS(TS<DataType> toCopy,
            int m,
            int n,
            int lo,
            int hi)
Takes a TS type matrix, and partially copies it into ICRS. Warning: sorts the TS matrix to CRS form first!

Parameters:
toCopy - The matrix to copy.
m - Number of rows in the resulting matrix (can differ from toCopy if it is in local view)
n - Number of columns in the resulting matrix (can differ from toCopy if it is in local view)
lo - Lower bound of the index from the TS to copy.
hi - Upper bound on the indices (exclusive).

ICRS

protected ICRS(ICRS<DataType> toCopy)
Deep copy constructor.

Method Detail

CRS2ICRS

protected void CRS2ICRS()
Internal conversion helper function.


toICRS

public ICRS<DataType> toICRS()
Description copied from class: SparseMatrix
Warning: returns current matrix if this matrix already is CRS.

Specified by:
toICRS in class SparseMatrix<DataType extends MatrixData<DataType>,ICRS<DataType extends MatrixData<DataType>>>
Returns:
CRS version of the current matrix.

toCRS

public CRS<DataType> toCRS()
Description copied from class: SparseMatrix
Warning: returns current matrix if this matrix already is CRS.

Specified by:
toCRS in class SparseMatrix<DataType extends MatrixData<DataType>,ICRS<DataType extends MatrixData<DataType>>>
Returns:
CRS version of the current matrix.

toTS

public TS<DataType> toTS()
Description copied from class: SparseMatrix
Warning: returns current matrix if this matrix already is TS.

Specified by:
toTS in class SparseMatrix<DataType extends MatrixData<DataType>,ICRS<DataType extends MatrixData<DataType>>>
Returns:
TS version of the current matrix.

removeAndAddDuplicates

public void removeAndAddDuplicates()
Description copied from class: Matrix
Removes and combines any double entries.

Specified by:
removeAndAddDuplicates in class Matrix<DataType extends MatrixData<DataType>>

safeClone

public ICRS<DataType> safeClone()