public class WeightedVector<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected Map<T,WeightedValue<T>> |
valueToWeightedValue |
| Modifier | Constructor and Description |
|---|---|
|
WeightedVector() |
protected |
WeightedVector(Map<T,WeightedValue<T>> map) |
|
WeightedVector(WeightedVector<T> other) |
| Modifier and Type | Method and Description |
|---|---|
WeightedVector<T> |
add(WeightedVector<T> other) |
void |
addWeight(T v,
double weight) |
void |
clear() |
Handler<WeightedValue<T>,Exception> |
createAddValueHandler() |
Handler<WeightedValue<T>,Exception> |
createSubtractValueHandler() |
double |
dotMultiplyBy(WeightedVector<T> other) |
double |
getMagnitude() |
double |
getWeight(T v) |
Set<T> |
keySet() |
WeightedVector<T> |
multiplyBy(double c) |
WeightedVector<T> |
multiplyByTransposeOf(WeightedVector<T> other) |
void |
normalize()
Turns this vector into a unit vector (unless it is a zero vector).
|
void |
normalizeAsDist()
Note: assumes all non-negative weights.
|
WeightedVector<T> |
normalized() |
WeightedVector<T> |
normalizedAsDist() |
WeightedVector<T> |
positiveClip()
Removes each negative element from the vector.
|
void |
setWeight(T v,
double weight) |
int |
size() |
WeightedVector<T> |
subtract(WeightedVector<T> other) |
WeightedValue<T>[] |
toArray() |
WeightedValue<T>[] |
toSortedArray() |
Collection<WeightedValue<T>> |
values() |
protected Map<T,WeightedValue<T>> valueToWeightedValue
public WeightedVector()
public WeightedVector(WeightedVector<T> other)
protected WeightedVector(Map<T,WeightedValue<T>> map)
public int size()
public Collection<WeightedValue<T>> values()
public double getWeight(T v)
public void setWeight(T v, double weight)
public void addWeight(T v, double weight)
public Handler<WeightedValue<T>,Exception> createAddValueHandler()
public Handler<WeightedValue<T>,Exception> createSubtractValueHandler()
public WeightedValue<T>[] toArray()
public WeightedValue<T>[] toSortedArray()
public void clear()
public double getMagnitude()
public WeightedVector<T> multiplyBy(double c)
c - public WeightedVector<T> add(WeightedVector<T> other)
other - another vector to add to this onepublic WeightedVector<T> subtract(WeightedVector<T> other)
other - another vector to subtract from this onepublic double dotMultiplyBy(WeightedVector<T> other)
other - public WeightedVector<T> multiplyByTransposeOf(WeightedVector<T> other)
other - public WeightedVector<T> positiveClip()
public void normalize()
public WeightedVector<T> normalized()
public void normalizeAsDist()
public WeightedVector<T> normalizedAsDist()
Copyright © 2007-2012 fortytwo.net. All Rights Reserved.