baseCode.dataStructure.matrix
Class SparseDoubleMatrix2DNamed

java.lang.Object
  extended bybaseCode.dataStructure.matrix.AbstractNamedMatrix
      extended bybaseCode.dataStructure.matrix.AbstractNamedDoubleMatrix
          extended bybaseCode.dataStructure.matrix.SparseDoubleMatrix2DNamed
All Implemented Interfaces:
NamedMatrix

public class SparseDoubleMatrix2DNamed
extends AbstractNamedDoubleMatrix
implements NamedMatrix

Title: SparseDoubleMatrix2DNamed

Description: A sparse matrix that knows about row and column names.

Copyright (c) 2004

Institution:: Columbia University

Version:
$Id: SparseDoubleMatrix2DNamed.java,v 1.5 2004/08/16 02:06:01 pavlidis Exp $
Author:
Paul Pavlidis

Constructor Summary
SparseDoubleMatrix2DNamed(double[][] T)
           
SparseDoubleMatrix2DNamed(int rows, int cols)
           
 
Method Summary
 int cardinality()
           
 int columns()
          Get the number of columns the matrix has.
 void ensureCapacity(int minNonZeros)
           
 double get(int row, int column)
           
 double[] getCol(int col)
          Return a copy of a given column.
 java.lang.Object[] getColObj(int col)
           
 double getQuick(int row, int column)
           
 double[] getRow(int row)
          Return a reference to a specific row.
 cern.colt.list.DoubleArrayList getRowArrayList(int i)
           
 double[] getRowByName(java.lang.String s)
           
 java.lang.Object[] getRowObj(int row)
          Get a row in the matrix as a generic Object[].
 boolean isMissing(int i, int j)
          Check if the value at a given index is missing.
 int rows()
          Get the number of rows the matrix has
 void set(int row, int column, double value)
           
 void set(int row, int col, java.lang.Object value)
          Set a value in the matrix.
 void setQuick(int row, int column, double value)
           
 int size()
           
 java.lang.String toString()
           
 void trimToSize()
           
 cern.colt.matrix.DoubleMatrix1D viewColumn(int column)
           
 cern.colt.matrix.DoubleMatrix1D viewRow(int row)
           
 
Methods inherited from class baseCode.dataStructure.matrix.AbstractNamedMatrix
addColumnName, addColumnName, addRowName, addRowName, containsColumnName, containsRowName, getColIndexByName, getColName, getColNames, getRowIndexByName, getRowName, getRowNameMapIterator, getRowNames, hasColNames, hasRow, hasRowNames, numMissing, setColumnNames, setRowNames
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface baseCode.dataStructure.matrix.NamedMatrix
addColumnName, addRowName, containsColumnName, containsRowName, getColIndexByName, getColName, getColNames, getRowIndexByName, getRowName, getRowNameMapIterator, getRowNames, hasColNames, hasRow, hasRowNames, numMissing, setColumnNames, setRowNames
 

Constructor Detail

SparseDoubleMatrix2DNamed

public SparseDoubleMatrix2DNamed(double[][] T)
Parameters:
T - double[][]

SparseDoubleMatrix2DNamed

public SparseDoubleMatrix2DNamed(int rows,
                                 int cols)
Parameters:
rows - int
cols - int
Method Detail

set

public void set(int row,
                int col,
                java.lang.Object value)
Description copied from interface: NamedMatrix
Set a value in the matrix.

Specified by:
set in interface NamedMatrix
Specified by:
set in class AbstractNamedDoubleMatrix

getRow

public double[] getRow(int row)
Return a reference to a specific row.

Specified by:
getRow in class AbstractNamedDoubleMatrix
Parameters:
row - int
Returns:
double[]

getCol

public double[] getCol(int col)
Return a copy of a given column.

Parameters:
col - int
Returns:
double[]

getRowObj

public java.lang.Object[] getRowObj(int row)
Description copied from interface: NamedMatrix
Get a row in the matrix as a generic Object[]. This exists so NamedMatrices can be used more generically.

Specified by:
getRowObj in interface NamedMatrix
Specified by:
getRowObj in class AbstractNamedDoubleMatrix

getColObj

public java.lang.Object[] getColObj(int col)
Specified by:
getColObj in interface NamedMatrix
Specified by:
getColObj in class AbstractNamedDoubleMatrix

toString

public java.lang.String toString()
Returns:
java.lang.String

getRowByName

public double[] getRowByName(java.lang.String s)
Overrides:
getRowByName in class AbstractNamedDoubleMatrix
Parameters:
s - String
Returns:
double[]

isMissing

public boolean isMissing(int i,
                         int j)
Description copied from interface: NamedMatrix
Check if the value at a given index is missing.

Specified by:
isMissing in interface NamedMatrix
Specified by:
isMissing in class AbstractNamedDoubleMatrix

columns

public int columns()
Description copied from interface: NamedMatrix
Get the number of columns the matrix has.

Specified by:
columns in interface NamedMatrix
Specified by:
columns in class AbstractNamedDoubleMatrix
Returns:

get

public double get(int row,
                  int column)
Specified by:
get in class AbstractNamedDoubleMatrix
Parameters:
row -
column -
Returns:

getQuick

public double getQuick(int row,
                       int column)
Specified by:
getQuick in class AbstractNamedDoubleMatrix
Parameters:
row -
column -
Returns:

rows

public int rows()
Description copied from interface: NamedMatrix
Get the number of rows the matrix has

Specified by:
rows in interface NamedMatrix
Specified by:
rows in class AbstractNamedDoubleMatrix
Returns:

set

public void set(int row,
                int column,
                double value)
Specified by:
set in class AbstractNamedDoubleMatrix
Parameters:
row -
column -
value -

setQuick

public void setQuick(int row,
                     int column,
                     double value)
Parameters:
row -
column -
value -

viewColumn

public cern.colt.matrix.DoubleMatrix1D viewColumn(int column)
Parameters:
column -
Returns:

viewRow

public cern.colt.matrix.DoubleMatrix1D viewRow(int row)
Specified by:
viewRow in class AbstractNamedDoubleMatrix
Parameters:
row -
Returns:

cardinality

public int cardinality()
Returns:

ensureCapacity

public void ensureCapacity(int minNonZeros)
Parameters:
minNonZeros -

size

public int size()
Returns:

trimToSize

public void trimToSize()

getRowArrayList

public cern.colt.list.DoubleArrayList getRowArrayList(int i)
Specified by:
getRowArrayList in class AbstractNamedDoubleMatrix


Copyright © 2003-2005 Columbia University. All Rights Reserved.