|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.torstennahm.integrate.sparse.index.StackedIndex
public class StackedIndex
Implements Index
.
Only the modification to a parent index is stored. In this way, each index is effectively
given as a series of changes to the original 0 index. This makes for
a low memory footprint and very fast generation times. However, due to
the stacked nature of the indices, the methods getEntry,
intPairIterator
,
nonZeroEntries
and equals
may be slow.
Also, while addEntry
is fast, setEntry
may be slow.
This is due to the fact that modifictations are stored as increments to an
entry, not as absolute entry values.
Constructor Summary | |
---|---|
StackedIndex()
|
Method Summary | |
---|---|
Index |
add(int entryNum,
int increment)
Returns a new index with the specified increment at the specified entry. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this index for equality. |
int |
get(int number)
Returns the value for the specified entry. |
int |
hashCode()
Returns the hash code value for this index. |
java.util.Iterator<de.torstennahm.math.IntEntry> |
iterator()
Returns an IntPairIterator for iterating over the index. |
int |
lastEntry()
Returns the index of highest entry whose value is not 0. |
int |
nonZeroEntries()
Returns the number of entries with values not equal to 0. |
Index |
set(int entryNum,
int value)
Returns a new index with the specified new value at the specified entry. |
int |
sum()
Returns the the sum of all entry values. |
protected de.torstennahm.math.SparseIntVector |
toSparseIntVector()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StackedIndex()
Method Detail |
---|
public int nonZeroEntries()
Index
public int lastEntry()
Index
public int get(int number)
Index
number
- number of the entry
public Index set(int entryNum, int value)
Index
entryNum
- number of the entryvalue
- new value for the entry
public Index add(int entryNum, int increment)
Index
entryNum
- number of the entryincrement
- increment for the entry, may be negative
public int sum()
Index
public java.util.Iterator<de.torstennahm.math.IntEntry> iterator()
Index
IntPairIterator
for iterating over the index.
The iterator skips all entries whose value is zero.
public int hashCode()
Index
hashCode
in interface Index
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
Index
Index
interface.
equals
in interface Index
equals
in class java.lang.Object
protected de.torstennahm.math.SparseIntVector toSparseIntVector()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |