baseCode.dataStructure.matrix
Class DenseDoubleMatrix2DNamed

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

public class DenseDoubleMatrix2DNamed
extends AbstractNamedDoubleMatrix

A matrix of doubles that knows about row and column names.

Copyright (c) 2004

Columbia University

Version:
$Id: DenseDoubleMatrix2DNamed.java,v 1.7 2005/01/05 02:01:02 pavlidis Exp $
Author:
Paul Pavlidis

Constructor Summary
DenseDoubleMatrix2DNamed(double[][] T)
           
DenseDoubleMatrix2DNamed(int rows, int cols)
           
 
Method Summary
 int columns()
          Get the number of columns the matrix has.
 DenseDoubleMatrix2DNamed copy()
          Make a copy of a matrix.
 double get(int row, int column)
           
 double[] getCol(int col)
          Return a copy of a given column.
 double[] getColByName(java.lang.String s)
          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)
          Return a reference to a specific row.
 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()
           
 double[][] toArray()
           
 java.lang.String toString()
           
 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
 

Constructor Detail

DenseDoubleMatrix2DNamed

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

DenseDoubleMatrix2DNamed

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

getRow

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

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

getRowByName

public double[] getRowByName(java.lang.String s)
Return a reference to a specific row.

Overrides:
getRowByName in class AbstractNamedDoubleMatrix
Parameters:
s - String
Returns:
double[]

getCol

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

Parameters:
col - int
Returns:
double[]

getColByName

public double[] getColByName(java.lang.String s)
Return a copy of a given column.

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

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

copy

public DenseDoubleMatrix2DNamed copy()
Make a copy of a matrix.

Returns:
baseCode.dataStructure.DenseDoubleMatrix2DNamed

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

get

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

getQuick

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

set

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

setQuick

public void setQuick(int row,
                     int column,
                     double value)
Parameters:
row - int
column - int
value - double
See Also:
DenseDoubleMatrix2D.setQuick(int, int, double)

viewColumn

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

viewRow

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

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:
the number of columns in the matrix
See Also:
AbstractMatrix2D.columns()

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:
the number of rows in the matrix
See Also:
AbstractMatrix2D#rows()

size

public int size()
Returns:
int
See Also:
AbstractMatrix2D#size()

toArray

public double[][] toArray()
Returns:
double[][]

getRowArrayList

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


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