public class Centroid extends Vector
DatabaseUtil
for
easier to use APIs.NumberVector.Factory<V extends NumberVector<? extends N>,N extends Number>
Modifier and Type | Field and Description |
---|---|
protected double |
wsum
The current weight.
|
elements, ERR_MATRIX_INNERDIM, ERR_VEC_DIMENSIONS
Constructor and Description |
---|
Centroid(int dim)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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,
DBIDs 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.
|
<F extends NumberVector<?>> |
toVector(Relation<? extends F> relation)
Get the data as vector.
|
byteValue, clone, copy, cross3D, doubleValue, equals, euclideanLength, floatValue, get, getArrayCopy, getArrayRef, getColumnVector, getDimensionality, getMax, getMin, getValue, hashCode, intValue, longValue, minus, minusEquals, minusEquals, minusTimes, minusTimesEquals, normalize, plus, plusEquals, plusEquals, plusTimes, plusTimesEquals, projection, randomNormalizedVector, rotate90Equals, set, setZero, shortValue, times, times, timesEquals, timesTranspose, timesTranspose, toString, toStringNoWhitespace, transposeTimes, transposeTimes, transposeTimesTimes, unitVector
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<?>> F toVector(Relation<? extends F> relation)
F
- vector typerelation
- Data relationpublic static Centroid make(Matrix mat)
mat
- Matrix to use the columns from.public static Centroid make(Relation<? extends NumberVector<?>> relation)
relation
- Relation to usepublic static Centroid make(Relation<? extends NumberVector<?>> relation, DBIDs ids)
relation
- Relation to useids
- IDs to use