|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.lmu.ifi.dbs.elki.math.linearalgebra.Vector de.lmu.ifi.dbs.elki.math.linearalgebra.Centroid
public class Centroid
Class to compute the centroid of some data.
Note: this class abstracts the efficient and numerical stable computation of
centroids.
See DatabaseUtil
for
easier to use APIs.
Field Summary | |
---|---|
private static long |
serialVersionUID
Serial version |
protected double |
wsum
The current weight |
Fields inherited from class de.lmu.ifi.dbs.elki.math.linearalgebra.Vector |
---|
elements |
Constructor Summary | |
---|---|
Centroid(int dim)
Constructor. |
Method Summary | ||
---|---|---|
static Centroid |
make(Matrix mat)
Static Constructor from an existing matrix columns. |
|
static Centroid |
make(Relation<? extends NumberVector<?,?>> relation)
Static constructor from an existing relation. |
|
static Centroid |
make(Relation<? extends NumberVector<?,?>> relation,
Iterable<DBID> ids)
Static constructor from an existing relation. |
|
void |
put(double[] val)
Add a single value with weight 1.0 |
|
void |
put(double[] val,
double weight)
Add data with a given weight. |
|
void |
put(NumberVector<?,?> val)
Add a single value with weight 1.0 |
|
void |
put(NumberVector<?,?> val,
double weight)
Add data with a given weight. |
|
void |
put(Vector val)
Add a single value with weight 1.0 |
|
void |
put(Vector val,
double weight)
Add data with a given weight. |
|
|
toVector(Relation<? extends F> relation)
Get the data as vector |
Methods inherited from class de.lmu.ifi.dbs.elki.math.linearalgebra.Vector |
---|
clone, copy, equals, euclideanLength, get, get, getArrayCopy, getArrayRef, getColumnDimensionality, getColumnVector, getDimensionality, getRowDimensionality, hashCode, increment, inverseVector, minus, minusEquals, minusEquals, minusTimes, minusTimesEquals, normalize, normF, plus, plusEquals, plusEquals, plusTimes, plusTimesEquals, projection, randomNormalizedVector, scalarProduct, set, set, setZero, sqrtVector, times, times, timesEquals, timesTranspose, toString, toStringNoWhitespace, transpose, transposeTimes, transposeTimes, unitVector |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
protected double wsum
Constructor Detail |
---|
public Centroid(int dim)
dim
- DimensionalityMethod Detail |
---|
public void put(double[] val)
val
- Valuepublic void put(double[] val, double weight)
val
- dataweight
- weightpublic final void put(Vector val)
val
- Valuepublic final void put(Vector val, double weight)
val
- dataweight
- weightpublic void put(NumberVector<?,?> val)
val
- Valuepublic void put(NumberVector<?,?> val, double weight)
val
- dataweight
- weightpublic <F extends NumberVector<? extends F,?>> F toVector(Relation<? extends F> relation)
public static Centroid make(Matrix mat)
mat
- Matrix to use the columns from.public static Centroid make(Relation<? extends NumberVector<?,?>> relation)
relation
- Relation to use
public static Centroid make(Relation<? extends NumberVector<?,?>> relation, Iterable<DBID> ids)
relation
- Relation to useids
- IDs to use
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |