|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<F,Integer>
edu.umd.cloud9.io.VectorInt<F>
F - type of featurepublic class VectorInt<F extends WritableComparable>
Writable representing a vector of integer values. This generic class, based
on the Java HashMap, supports the use of any class for the features
(i.e., component of the vector), but all values are integers.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Constructor Summary | |
|---|---|
VectorInt()
Creates a VectorInt object. |
|
| Method Summary | |
|---|---|
int |
dot(VectorInt<F> v)
Computes the dot product between this vector and another vector. |
int |
get(F f)
Returns the value of a feature. |
SortedSet<Map.Entry<F,Integer>> |
getSortedEntries()
Returns feature-value entries sorted by descending value. |
SortedSet<Map.Entry<F,Integer>> |
getSortedEntries(int n)
Returns top n feature-value entries sorted by descending value. |
void |
plus(VectorInt<F> v)
Adds another vector to this vector, based on feature-wise addition. |
void |
readFields(DataInput in)
Deserializes the vector. |
void |
set(F f,
int v)
Sets the value of a feature. |
void |
write(DataOutput out)
Serializes the vector. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public VectorInt()
| Method Detail |
|---|
public void readFields(DataInput in)
throws IOException
readFields in interface Writablein - source for raw byte representation
IOException
public void write(DataOutput out)
throws IOException
write in interface Writableout - where to write the raw byte representation
IOException
public void set(F f,
int v)
f - the featurev - the valuepublic int get(F f)
f - the feature
public void plus(VectorInt<F> v)
v - vector to addpublic int dot(VectorInt<F> v)
v - the other vectorpublic SortedSet<Map.Entry<F,Integer>> getSortedEntries()
public SortedSet<Map.Entry<F,Integer>> getSortedEntries(int n)
n - number of entries to return
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||