public final class VectorUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
VectorUtil.SortDBIDsBySingleDimension
Compare number vectors by a single dimension.
|
static class |
VectorUtil.SortVectorsBySingleDimension
Compare number vectors by a single dimension.
|
Modifier | Constructor and Description |
---|---|
private |
VectorUtil()
Fake constructor.
|
Modifier and Type | Method and Description |
---|---|
static double |
angle(NumberVector v1,
NumberVector v2,
NumberVector o)
Compute the angle between two vectors.
|
static double |
angle(NumberVector v1,
NumberVector v2,
Vector o)
Compute the angle between two vectors.
|
static double |
angleSparse(SparseNumberVector v1,
SparseNumberVector v2)
Compute the angle for sparse vectors.
|
static Vector |
computeMedoid(Relation<? extends NumberVector> relation,
DBIDs sample)
Compute medoid for a given subset.
|
static double |
cosAngle(NumberVector v1,
NumberVector v2)
Compute the absolute cosine of the angle between two vectors.
|
static double[] |
fastTimes(Matrix mat,
NumberVector v)
This is an ugly hack, but we don't want to have the
Matrix class
depend on NumberVector . |
static double |
minCosAngle(SpatialComparable v1,
SpatialComparable v2)
Compute the minimum angle between two rectangles.
|
static <V extends NumberVector> |
project(V v,
long[] selectedAttributes,
NumberVector.Factory<V> factory)
Project a number vector to the specified attributes.
|
static <V extends NumberVector> |
randomVector(NumberVector.Factory<V> factory,
int dim)
Produce a new vector based on random numbers in [0:1].
|
static <V extends NumberVector> |
randomVector(NumberVector.Factory<V> factory,
int dim,
Random r)
Produce a new vector based on random numbers in [0:1].
|
static double |
scalarProduct(NumberVector d1,
NumberVector d2)
Compute the scalar product (inner product) of this and the given
DoubleVector.
|
private VectorUtil()
public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim, Random r)
V
- vector typefactory
- Vector factorydim
- desired dimensionalityr
- Random generatorpublic static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim)
V
- vector typefactory
- Vector factorydim
- desired dimensionalitypublic static double angleSparse(SparseNumberVector v1, SparseNumberVector v2)
v1
- First vectorv2
- Second vectorpublic static double angle(NumberVector v1, NumberVector v2, Vector o)
v1
- first vectorv2
- second vectoro
- Originpublic static double angle(NumberVector v1, NumberVector v2, NumberVector o)
v1
- first vectorv2
- second vectoro
- Originpublic static double cosAngle(NumberVector v1, NumberVector v2)
Math.acos(angle)
!v1
- first vectorv2
- second vectorpublic static double minCosAngle(SpatialComparable v1, SpatialComparable v2)
v1
- first rectanglev2
- second rectanglepublic static double scalarProduct(NumberVector d1, NumberVector d2)
d1
- the first vector to compute the scalar product ford2
- the second vector to compute the scalar product forpublic static Vector computeMedoid(Relation<? extends NumberVector> relation, DBIDs sample)
relation
- Relation to processsample
- Sample setpublic static double[] fastTimes(Matrix mat, NumberVector v)
Matrix
class
depend on NumberVector
. Maybe a future version will no longer need
this.mat
- Matrixv
- Vectormat * v
, as double array.public static <V extends NumberVector> V project(V v, long[] selectedAttributes, NumberVector.Factory<V> factory)
V
- Vector typev
- a NumberVector to projectselectedAttributes
- the attributes selected for projectionfactory
- Vector factoryCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.