edu.stanford.nlp.linalg
Interface Matrix

All Superinterfaces:
Cloneable
All Known Subinterfaces:
GrowableMatrix
All Known Implementing Classes:
AbstractMatrix, ArrayListMatrix

public interface Matrix
extends Cloneable

Interface for Matrices, dense or sparse. Only requires functions necessary for clustering. Not a general linear algebra matrix interface


Method Summary
 int cardinality()
          Returns the number of cells having non-zero values; ignores tolerance.
 Object clone()
           
 Iterator columnIterator()
          iterates through all Array columns in the Matrix
 int columns()
          returns number of columns in matrix
 Iterator entryIterator()
          iterator: returns iterator over all Entries in matrix.
 Set entrySet()
          returns set of all Entries in matrix
 double get(int i, int j)
           
 Array getColumn(int index)
          returns column with index index
 Matrix normalizeColumns(Metric metric)
          returns Matrix whose columns are normalized to 1 does not change receiver
 int rows()
          returns number of rows in matrix
 void set(int i, int j, double value)
           
 void setColumn(int index, Array column)
          sets column with index index = column
 String toDenseString()
          Returns a dense string representation of matrix.
 String toMatlabSparseString()
          returns sparse string representation of matrix, in Matlab-readable format, ensuring that the first matrix entry is [1,1,value] rather than [0,0,value] i.e.
 String toSparseString()
          returns sparse string representation of matrix num_rows num_columns num_nonzero_entries row column value row column value ...
 String toString()
          returns bracket-delimited entrySet String representation of Matrix [[[row,column,value], [row,column,value]], [[row,column,value]...]
 

Method Detail

entryIterator

public Iterator entryIterator()
iterator: returns iterator over all Entries in matrix.


columnIterator

public Iterator columnIterator()
iterates through all Array columns in the Matrix


toString

public String toString()
returns bracket-delimited entrySet String representation of Matrix [[[row,column,value], [row,column,value]], [[row,column,value]...]

Overrides:
toString in class Object

toSparseString

public String toSparseString()
returns sparse string representation of matrix num_rows num_columns num_nonzero_entries row column value row column value ...


toMatlabSparseString

public String toMatlabSparseString()
returns sparse string representation of matrix, in Matlab-readable format, ensuring that the first matrix entry is [1,1,value] rather than [0,0,value] i.e. row column value row column value ...


toDenseString

public String toDenseString()
Returns a dense string representation of matrix. i.e. 3 x 4 matrix
 value    value   value    value
 value    value   value    value
 value    value   value    value
 value    value   value    value
 


getColumn

public Array getColumn(int index)
returns column with index index


setColumn

public void setColumn(int index,
                      Array column)
sets column with index index = column


entrySet

public Set entrySet()
returns set of all Entries in matrix


cardinality

public int cardinality()
Returns the number of cells having non-zero values; ignores tolerance.


set

public void set(int i,
                int j,
                double value)

get

public double get(int i,
                  int j)

rows

public int rows()
returns number of rows in matrix


columns

public int columns()
returns number of columns in matrix


normalizeColumns

public Matrix normalizeColumns(Metric metric)
returns Matrix whose columns are normalized to 1 does not change receiver


clone

public Object clone()
Overrides:
clone in class Object


Stanford NLP Group