edu.stanford.nlp.linalg
Class DenseNumberArray
java.lang.Object
|
+--edu.stanford.nlp.linalg.AbstractArray
|
+--edu.stanford.nlp.linalg.DenseNumberArray
- All Implemented Interfaces:
- Array, Cloneable
- Direct Known Subclasses:
- DenseSNDArray
- public abstract class DenseNumberArray
- extends AbstractArray
An Array wrapper for an array of Numbers.
Differs from DenseDoubleArray in that it stores the Numbers rather than the primitive doubles
Helpful when one needs to store BigDecimals or ScientificNotationDoubles
Does not define set(int i, int val) or set(int i, double val); the subclasses, such as DenseScientificNotationDoubleArray should define these methods
Method Summary |
boolean |
containsKey(int key)
Returns true if the array contains index key |
double |
get(int i)
Gets double value of element at index i |
Number |
getNumber(int i)
|
Iterator |
iterator()
Returns a set view of the Entries contained in this Array. |
void |
set(int i,
Number val)
|
int |
size()
Returns number of elements in Array |
Methods inherited from class edu.stanford.nlp.linalg.AbstractArray |
add, cardinality, clone, columnIndex, distance, divide, divide, dot, entrySet, multiply, multiply, norm, normalize, scale, setAll, setColumnIndex, toLogSpace, toString |
array
protected Number[] array
DenseNumberArray
public DenseNumberArray(int num_elements)
DenseNumberArray
public DenseNumberArray(Number[] array)
getNumber
public Number getNumber(int i)
get
public double get(int i)
- Description copied from interface:
Array
- Gets double value of element at index i
set
public void set(int i,
Number val)
size
public int size()
- Description copied from interface:
Array
- Returns number of elements in Array
containsKey
public boolean containsKey(int key)
- Description copied from interface:
Array
- Returns true if the array contains index
key
iterator
public Iterator iterator()
- Returns a set view of the Entries contained in this Array.
Stanford NLP Group