edu.stanford.nlp.linalg
Class AbstractArray

java.lang.Object
  |
  +--edu.stanford.nlp.linalg.AbstractArray
All Implemented Interfaces:
Array, Cloneable
Direct Known Subclasses:
ColtSparseDoubleArray, DenseDoubleArray, DenseIntArray, DenseNumberArray, GrowableDenseDoubleArray, GrowableDenseIntArray

public abstract class AbstractArray
extends Object
implements Array

Abstract Array class


Field Summary
protected  int ci
           
 
Constructor Summary
AbstractArray()
           
 
Method Summary
 Array add(Array addend)
          Returns this + addend does not change receiver.
 int cardinality()
          Returns the number of cells having non-zero values; ignores tolerance.
abstract  Object clone()
          Returns deep copy of Array
 int columnIndex()
          Returns column index of column vector
 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)
          return dot product of this with other Operates on cells at indexes 0 ..
 Set entrySet()
          Returns a set view of the Entries contained in this array.
 Array multiply(Array multiplicand)
          returns componentwise multiply
 Array multiply(double multiplicand)
          scalar multiply
 double norm()
          returns 2 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 setAll(double value)
          sets all elements = value (in sparse matrices, sets all nonzero elements = value)
 void setColumnIndex(int column)
          setColumnIndex(ci).
 Array toLogSpace()
          Transforms the array to log space.
 String toString()
          Returns String representation of Array
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.stanford.nlp.linalg.Array
containsKey, equals, get, iterator, newInstance, set, size
 

Field Detail

ci

protected int ci
Constructor Detail

AbstractArray

public AbstractArray()
Method Detail

setColumnIndex

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

Specified by:
setColumnIndex in interface Array

columnIndex

public int columnIndex()
Description copied from interface: Array
Returns column index of column vector

Specified by:
columnIndex in interface Array

setAll

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

Specified by:
setAll in interface Array

toString

public String toString()
Description copied from interface: Array
Returns String representation of Array

Specified by:
toString in interface Array
Overrides:
toString in class Object

entrySet

public Set entrySet()
Description copied from interface: Array
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.

Specified by:
entrySet in interface Array

clone

public abstract Object clone()
Description copied from interface: Array
Returns deep copy of Array

Specified by:
clone in interface Array
Overrides:
clone in class Object

add

public Array add(Array addend)
Description copied from interface: Array
Returns this + addend does not change receiver.

Specified by:
add in interface Array

scale

public Array scale(double factor)
Description copied from interface: Array
Returns this * factor does not change receiver.

Specified by:
scale in interface Array

norm

public double norm()
returns 2 norm of vector

Specified by:
norm in interface Array

normalize

public Array normalize()
Description copied from interface: Array
Returns vector with euclidian distance normalized to 1. does not change reciever.

Specified by:
normalize in interface Array

dot

public double dot(Array other)
return dot product of this with other Operates on cells at indexes 0 .. Math.min(size(),other.size())

Specified by:
dot in interface Array

distance

public double distance(Array other)
Description copied from interface: Array
Returns Euclidean distance from this to other

Specified by:
distance in interface Array

cardinality

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

Specified by:
cardinality in interface Array

multiply

public Array multiply(Array multiplicand)
returns componentwise multiply

Specified by:
multiply in interface Array

divide

public Array divide(Array dividend)
returns componentwise divide: this/dividend

Specified by:
divide in interface Array

multiply

public Array multiply(double multiplicand)
scalar multiply

Specified by:
multiply in interface Array

divide

public Array divide(double dividend)
scalar divide

Specified by:
divide in interface Array

toLogSpace

public Array toLogSpace()
Description copied from interface: Array
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

Specified by:
toLogSpace in interface Array


Stanford NLP Group