edu.stanford.nlp.linalg
Class ArrayListMatrix

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

public class ArrayListMatrix
extends AbstractMatrix
implements GrowableMatrix

An ArrayList of arrays


Field Summary
 
Fields inherited from class edu.stanford.nlp.linalg.AbstractMatrix
nc, nnz, nr
 
Constructor Summary
ArrayListMatrix()
           
ArrayListMatrix(int size)
           
ArrayListMatrix(int num_rows, int num_columns)
           
ArrayListMatrix(String filename)
           
 
Method Summary
 int addColumn(Array v)
          insert column vector v into the ith column of the matrix.
 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
 Object clone()
           
 Iterator columnIterator()
          returns iterator over all column in matrix.
 double get(int i, int j)
          Returns the matrix cell value at coordinate [row,column].
 Array getColumn(int index)
          returns index'th column of Matrix
 void removeColumn(int index)
           
 void set(int i, int j, double value)
          sets i,j th element of Matrix to value
 void setColumn(int index, Array column)
          sets column with index index = column
 
Methods inherited from class edu.stanford.nlp.linalg.AbstractMatrix
cardinality, columns, entryIterator, entrySet, normalizeColumns, rows, tfidf, toDenseString, toMatlabSparseString, toSparseString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.stanford.nlp.linalg.Matrix
cardinality, columns, entryIterator, entrySet, normalizeColumns, rows, toDenseString, toMatlabSparseString, toSparseString, toString
 

Constructor Detail

ArrayListMatrix

public ArrayListMatrix()

ArrayListMatrix

public ArrayListMatrix(int size)

ArrayListMatrix

public ArrayListMatrix(int num_rows,
                       int num_columns)

ArrayListMatrix

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

addColumn

public int addColumn(Array v)
insert column vector v into the ith column of the matrix.

Specified by:
addColumn in interface GrowableMatrix

removeColumn

public void removeColumn(int index)

columnIterator

public Iterator columnIterator()
returns iterator over all column in matrix.

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

getColumn

public Array getColumn(int index)
returns index'th column of Matrix

Specified by:
getColumn in interface Matrix

set

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

Specified by:
set in interface Matrix

get

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

Specified by:
get in interface Matrix
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

clone

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

setColumn

public void setColumn(int index,
                      Array column)
Description copied from interface: Matrix
sets column with index index = column

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


Stanford NLP Group