edu.stanford.nlp.linalg
Interface Array

All Superinterfaces:
Cloneable

public interface Array
extends Cloneable

Interface for dense or sparse arrays which store numbers.

Author:
Sepandar Kamvar (sdkamvar@stanford.edu)

Method Summary
 Array add(Array addend)
          Returns this + addend does not change receiver.
 int cardinality()
          Returns number of nonzero entries in array
 Object clone()
          Returns deep copy of Array
 int columnIndex()
          Returns column index of column vector
 boolean containsKey(int key)
          Returns true if the array contains index key
 double distance(Array other)
          Returns Euclidean distance from this to other
 Array divide(Array dividend)
          Returns componentwise divide: this/dividend
 Array divide(double dividend)
          Scalar divide
 double dot(Array other)
          Returns dot product of this with other
 Set entrySet()
          Returns a set view of the Entries contained in this array.
 boolean equals(Object o)
          Returns true if o==this
 double get(int index)
          Gets double value of element at index i
 Iterator iterator()
          Returns an iterator over the entries in the matrix
 Array multiply(Array multiplicand)
          Returns componentwise multiply
 Array multiply(double multiplicand)
          Scalar multiply
 Array newInstance(int size)
          Returns an empty Array of the same dynamic type with given size
 double norm()
          Returns L2 norm of vector
 Array normalize()
          Returns vector with euclidian distance normalized to 1.
 Array scale(double factor)
          Returns this * factor does not change receiver.
 void set(int i, double val)
          Sets value of element at index i to val
 void setAll(double value)
          Sets all elements = value (in sparse matrices, sets all nonzero elements = value)
 void setColumnIndex(int ci)
          Sets column index of column vector.
 int size()
          Returns number of elements in Array
 Array toLogSpace()
          Transforms the array to log space.
 String toString()
          Returns String representation of Array
 

Method Detail

setColumnIndex

void setColumnIndex(int ci)
Sets column index of column vector. the default is -1;


columnIndex

int columnIndex()
Returns column index of column vector


setAll

void setAll(double value)
Sets all elements = value (in sparse matrices, sets all nonzero elements = value)


get

double get(int index)
Gets double value of element at index i


set

void set(int i,
         double val)
Sets value of element at index i to val


size

int size()
Returns number of elements in Array


entrySet

Set entrySet()
Returns a set view of the Entries contained in this array. Note: this differs from java.util.AbstractMap.entrySet() in that it returns a Set of Entries, rather than a set of objects.


containsKey

boolean containsKey(int key)
Returns true if the array contains index key


iterator

Iterator iterator()
Returns an iterator over the entries in the matrix


equals

boolean equals(Object o)
Returns true if o==this

Overrides:
equals in class Object

toString

String toString()
Returns String representation of Array

Overrides:
toString in class Object

clone

Object clone()
Returns deep copy of Array


newInstance

Array newInstance(int size)
Returns an empty Array of the same dynamic type with given size


add

Array add(Array addend)
Returns this + addend does not change receiver.


scale

Array scale(double factor)
Returns this * factor does not change receiver.


norm

double norm()
Returns L2 norm of vector


distance

double distance(Array other)
Returns Euclidean distance from this to other


dot

double dot(Array other)
Returns dot product of this with other


multiply

Array multiply(Array multiplicand)
Returns componentwise multiply


divide

Array divide(Array dividend)
Returns componentwise divide: this/dividend


multiply

Array multiply(double multiplicand)
Scalar multiply


divide

Array divide(double dividend)
Scalar divide


normalize

Array normalize()
Returns vector with euclidian distance normalized to 1. does not change reciever.


cardinality

int cardinality()
Returns number of nonzero entries in array


toLogSpace

Array toLogSpace()
Transforms the array to log space. this is kind of a hack, so try to fix it later, by defining things like componentwise array functions, etc. takes the log of each component in array



Stanford NLP Group