|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object infomat.vectorspace.ivector.IVector<T>
public class IVector<T extends IVectorIndex>
An implementation of a sparse vector. Should be thought of as a java.util.HashMap rather than a java.util.Vector. Contains Objects that implements the IVectorIndex interface. Consisits of a hashmap, mapping such objects to Float:s.
Nested Class Summary | |
---|---|
private class |
IVector.IDComparator
Private class for ordering the Ts in order of their ID. |
private class |
IVector.TLiteralComparator
Private class for ordering the Ts in literal order. |
private class |
IVector.TValueComparator
Private class for ordering the Ts in value order. |
Field Summary | |
---|---|
private java.util.HashMap<T,java.lang.Float> |
objectValueMap
The sparse representation, a map from T:s to Float values. |
Constructor Summary | |
---|---|
IVector()
|
|
IVector(java.util.HashMap<T,java.lang.Float> map)
Copies the map. |
|
IVector(IVector<T> vec)
Copies the map. |
Method Summary | ||
---|---|---|
void |
add(java.util.HashMap<T,java.lang.Float> map)
Uses the add(T, Float) method. |
|
void |
add(IVector<T> vec)
Uses the add(T, Float) method. |
|
void |
add(T t,
java.lang.Float f)
Adds the value f to the previosus value for the T t. |
|
static
|
cartesianDistance(IVector<U> vec1,
IVector<V> vec2)
Returns the cartesian distance between the two IVector:s. |
|
static
|
cartesianDistance(IVector<U> vec1,
IVector<V> vec2,
double sqDist)
Returns the cartesian distance between the two IVector:s, using the squared distance to origo for the second. |
|
static
|
cartesianSquaredDistanceFromOrigo(IVector<V> vec)
Returns the cartesian distance from Origo for the vector. |
|
boolean |
contains(T t)
|
|
static
|
corrCoeff(IVector<T> vec1,
IVector<T> vec2)
Returns the correlation coefficient for the two IVector:s. |
|
static
|
covar(IVector<T> vec1,
IVector<T> vec2)
Returns the covariance for the two IVector:s. |
|
void |
dotMultiply(IVector<T> otherVec)
Like matlabs .* operator. |
|
static
|
dotMultiply(IVector<T> vec1,
IVector<T> vec2)
Like matlabs .* operator. |
|
static
|
dotProduct(IVector<U> vec1,
IVector<V> vec2)
Returns the scalar product of the two IVector:s. |
|
int |
getID()
|
|
java.lang.String |
getLocation()
|
|
java.util.HashMap<T,java.lang.Float> |
getMap()
Returns the actual map. |
|
java.util.Vector<T> |
getOrderedVector()
Returns a vector of T:s, orderd by their value. |
|
java.lang.String |
getString()
|
|
java.util.Vector<T> |
getUnorderedVector()
Returns a vector of T:s, in no particular order. |
|
java.lang.Float |
getValue(T t)
Returns the values for the specified T. |
|
T |
highestRanked()
Returns the highest ranked or null if empty. |
|
IVector<T> |
highestRanked(int n)
Returns the n highest ranked or as many as there is. |
|
java.util.Iterator<java.util.Map.Entry<T,java.lang.Float>> |
iterator()
|
|
IVector<T> |
largerThan(double min)
Returns only those that larger than the specified value. |
|
IVector<T> |
largerThanOrEquals(double min)
Returns only those that larger than the specified value. |
|
void |
log(double base)
Uses the log(T, double) method - takes the logarithm of all elements using the provided base. |
|
void |
log(T t,
double base)
Sets this value to its logarithm with the specified base. |
|
double |
mean()
Returns the mean of the stored values. |
|
void |
multiply(java.lang.Float f)
Uses the multiply(T, Float) method - multiplies all elements by the the provided value. |
|
void |
multiply(T t,
java.lang.Float f)
Multiplies this value with the value for the T. |
|
void |
normalize()
|
|
static
|
numberOfSharedElements(IVector<U> vec1,
IVector<V> vec2)
Returns the number of elements that are in both IVector:s. |
|
void |
print()
For debugging. |
|
void |
put(java.util.HashMap<T,java.lang.Float> map)
Uses the put(T, Float) method. |
|
void |
put(IVector<T> vec)
Uses the put(T, Float) method. |
|
void |
put(T t,
java.lang.Float f)
Sets the value for t to be f. |
|
void |
remove(T t)
|
|
void |
removeAll()
|
|
int |
size()
Returns the number of indexes used in this IVector. |
|
IVector<T> |
smallerThanOrEquals(double max)
Returns only those that larger than the specified value. |
|
void |
sortInIDOrder()
|
|
void |
sortInvert()
|
|
void |
sortLiteral()
|
|
void |
sortRandom()
|
|
double |
std()
Returns the standard deviation of the stored values. |
|
void |
subtract(java.util.HashMap<T,java.lang.Float> map)
Uses the subtract(T, Float) method. |
|
void |
subtract(IVector<T> vec)
Uses the subtract(T, Float) method. |
|
void |
subtract(T t,
java.lang.Float f)
Subtracts the value f from the value for the T. |
|
java.lang.String |
toString()
|
|
double |
variance()
Returns the standard deviation of the stored values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.HashMap<T extends IVectorIndex,java.lang.Float> objectValueMap
Constructor Detail |
---|
public IVector()
public IVector(java.util.HashMap<T,java.lang.Float> map)
public IVector(IVector<T> vec)
Method Detail |
---|
public void add(T t, java.lang.Float f)
public void add(IVector<T> vec)
public void add(java.util.HashMap<T,java.lang.Float> map)
public void put(T t, java.lang.Float f)
public void put(IVector<T> vec)
public void put(java.util.HashMap<T,java.lang.Float> map)
public void remove(T t)
public void removeAll()
public void subtract(T t, java.lang.Float f)
public void subtract(IVector<T> vec)
public void subtract(java.util.HashMap<T,java.lang.Float> map)
public void multiply(T t, java.lang.Float f)
public void multiply(java.lang.Float f)
public void dotMultiply(IVector<T> otherVec)
public static <T extends IVectorIndex> IVector<T> dotMultiply(IVector<T> vec1, IVector<T> vec2)
public void log(T t, double base)
public void log(double base)
public void normalize()
public T highestRanked()
public IVector<T> highestRanked(int n)
public IVector<T> largerThan(double min)
public IVector<T> largerThanOrEquals(double min)
public IVector<T> smallerThanOrEquals(double max)
public static <U extends IVectorIndex,V extends IVectorIndex> int numberOfSharedElements(IVector<U> vec1, IVector<V> vec2)
public static <U extends IVectorIndex,V extends IVectorIndex> float dotProduct(IVector<U> vec1, IVector<V> vec2)
public static <U extends IVectorIndex,V extends IVectorIndex> java.lang.Float cartesianDistance(IVector<U> vec1, IVector<V> vec2)
public static <U extends IVectorIndex,V extends IVectorIndex> java.lang.Float cartesianDistance(IVector<U> vec1, IVector<V> vec2, double sqDist)
public static <V extends IVectorIndex> double cartesianSquaredDistanceFromOrigo(IVector<V> vec)
public static <T extends IVectorIndex> double covar(IVector<T> vec1, IVector<T> vec2)
public static <T extends IVectorIndex> double corrCoeff(IVector<T> vec1, IVector<T> vec2)
public int size()
public double mean()
public double variance()
public double std()
public java.lang.Float getValue(T t)
public boolean contains(T t)
public java.util.HashMap<T,java.lang.Float> getMap()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Vector<T> getOrderedVector()
public java.util.Vector<T> getUnorderedVector()
public void sortLiteral()
public void sortRandom()
public void sortInvert()
public void sortInIDOrder()
public void print()
public java.util.Iterator<java.util.Map.Entry<T,java.lang.Float>> iterator()
public java.lang.String getString()
getString
in interface IVectorIndex
public java.lang.String getLocation()
getLocation
in interface IVectorIndex
public int getID()
getID
in interface IVectorIndex
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |