-
- All Implemented Interfaces:
-
java.io.Serializable,java.lang.Cloneable
public final class OrderedIntDoubleMapping implements Serializable, Cloneable
From mahout
-
-
Field Summary
Fields Modifier and Type Field Description public final static doubleDEFAULT_VALUEpublic final static OrderedIntDoubleMappingEMPTYprivate Array<int>indicesprivate Array<double>valuesprivate intnumMappings
-
Constructor Summary
Constructors Constructor Description OrderedIntDoubleMapping(boolean noDefault)Constructor for OrderedIntDoubleMapping. OrderedIntDoubleMapping()Constructor for OrderedIntDoubleMapping. OrderedIntDoubleMapping(int capacity)Constructor for OrderedIntDoubleMapping. OrderedIntDoubleMapping(Array<int> indices, Array<double> values, int numMappings)Constructor for OrderedIntDoubleMapping.
-
Method Summary
Modifier and Type Method Description Array<int>getIndices()Getter for the field indices.Array<double>getValues()Getter for the field values.intgetNumMappings()Getter for the field numMappings.booleanisEmpty()isEmpty. intindexAt(int offset)indexAt. voidsetIndexAt(int offset, int index)setIndexAt. voidsetValueAt(int offset, double value)setValueAt. SparseRealVectortoSparseVector(int dimension)toSparseVector. Array<double>toArray(int dim)toArray. doubleget(int index)get. voidset(int index, double value)set. voidmerge(OrderedIntDoubleMapping updates)Merges the updates in linear time by allocating new arrays and iterating through the existing indices and valuesand the updates' indices and values at the same time while selecting the minimum index to set at each step. inthashCode()booleanequals(Object o)StringtoString()OrderedIntDoubleMappingclone()voidincrement(int index, double increment)increment. -
-
Constructor Detail
-
OrderedIntDoubleMapping
OrderedIntDoubleMapping(boolean noDefault)
Constructor for OrderedIntDoubleMapping.- Parameters:
noDefault- a boolean.
-
OrderedIntDoubleMapping
OrderedIntDoubleMapping()
Constructor for OrderedIntDoubleMapping.
-
OrderedIntDoubleMapping
OrderedIntDoubleMapping(int capacity)
Constructor for OrderedIntDoubleMapping.- Parameters:
capacity- a int.
-
-
Method Detail
-
getIndices
Array<int> getIndices()
Getter for the field
indices.
-
getNumMappings
int getNumMappings()
Getter for the field
numMappings.
-
isEmpty
boolean isEmpty()
isEmpty.
-
indexAt
int indexAt(int offset)
indexAt.
- Parameters:
offset- a int.
-
setIndexAt
void setIndexAt(int offset, int index)
setIndexAt.
- Parameters:
offset- a int.index- a int.
-
setValueAt
void setValueAt(int offset, double value)
setValueAt.
- Parameters:
offset- a int.value- a double.
-
toSparseVector
SparseRealVector toSparseVector(int dimension)
toSparseVector.
- Parameters:
dimension- a int.
-
get
double get(int index)
get.
- Parameters:
index- a int.
-
set
void set(int index, double value)
set.
- Parameters:
index- a int.value- a double.
-
merge
void merge(OrderedIntDoubleMapping updates)
Merges the updates in linear time by allocating new arrays and iterating through the existing indices and valuesand the updates' indices and values at the same time while selecting the minimum index to set at each step.
- Parameters:
updates- another list of mappings to be merged in.
-
hashCode
int hashCode()
-
clone
OrderedIntDoubleMapping clone()
-
increment
void increment(int index, double increment)
increment.
- Parameters:
index- a int.increment- a double.
-
-
-
-