edu.stanford.nlp.linalg
Class ColtDenseMatrix

java.lang.Object
  |
  +--edu.stanford.nlp.linalg.AbstractMatrix
        |
        +--edu.stanford.nlp.linalg.ColtDenseMatrix
All Implemented Interfaces:
Cloneable, Matrix

public class ColtDenseMatrix
extends AbstractMatrix

A Wrapper for a DenseDoubleMatrix2D


Field Summary
 
Fields inherited from class edu.stanford.nlp.linalg.AbstractMatrix
nc, nnz, nr
 
Constructor Summary
ColtDenseMatrix(cern.colt.matrix.DoubleMatrix2D mat)
           
ColtDenseMatrix(int num_rows, int num_columns)
           
ColtDenseMatrix(String filename)
           
 
Method Summary
 void allocate(int num_rows, int num_columns)
          allocates memory for matrix of given size
 void allocate(int num_rows, int num_columns, int cardinality)
          allocates memory for matrix of given size and cardinality
 int cardinality()
          Returns the number of cells having non-zero values; ignores tolerance.
 Object clone()
           
 int columns()
          returns number of columns in matrix
 double get(int i, int j)
          Returns the matrix cell value at coordinate [row,column].
 Array getColumn(int index)
          returns number of columns in Matrix
 int rows()
          returns number of rows in matrix
 void set(int i, int j, double value)
          sets i,j th element of Matrix to value
 cern.colt.matrix.DoubleMatrix2D toDoubleMatrix2D()
           
 
Methods inherited from class edu.stanford.nlp.linalg.AbstractMatrix
columnIterator, entryIterator, entrySet, normalizeColumns, setColumn, tfidf, toDenseString, toMatlabSparseString, toSparseString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColtDenseMatrix

public ColtDenseMatrix(cern.colt.matrix.DoubleMatrix2D mat)

ColtDenseMatrix

public ColtDenseMatrix(int num_rows,
                       int num_columns)

ColtDenseMatrix

public ColtDenseMatrix(String filename)
                throws FileNotFoundException,
                       IOException
Method Detail

getColumn

public Array getColumn(int index)
returns number of columns in Matrix


set

public void set(int i,
                int j,
                double value)
sets i,j th element of Matrix to value


get

public double get(int i,
                  int j)
Returns the matrix cell value at coordinate [row,column].

Returns:
the value of the specified cell.
Throws:
IndexOutOfBoundsException - if column<0 || column>=columns() || row<0 || row>=rows()

allocate

public void allocate(int num_rows,
                     int num_columns)
allocates memory for matrix of given size

Specified by:
allocate in class AbstractMatrix

allocate

public void allocate(int num_rows,
                     int num_columns,
                     int cardinality)
allocates memory for matrix of given size and cardinality

Specified by:
allocate in class AbstractMatrix

toDoubleMatrix2D

public cern.colt.matrix.DoubleMatrix2D toDoubleMatrix2D()

clone

public Object clone()
Specified by:
clone in interface Matrix
Specified by:
clone in class AbstractMatrix

columns

public int columns()
Description copied from interface: Matrix
returns number of columns in matrix

Specified by:
columns in interface Matrix
Overrides:
columns in class AbstractMatrix

rows

public int rows()
Description copied from interface: Matrix
returns number of rows in matrix

Specified by:
rows in interface Matrix
Overrides:
rows in class AbstractMatrix

cardinality

public int cardinality()
Description copied from interface: Matrix
Returns the number of cells having non-zero values; ignores tolerance.

Specified by:
cardinality in interface Matrix
Overrides:
cardinality in class AbstractMatrix


Stanford NLP Group