public final class VectorUtil
extends java.lang.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 with respect to a reference point.
|
static double |
angleDense(NumberVector v1,
NumberVector v2)
Compute the absolute cosine of the angle between two dense vectors.
|
static double |
angleSparse(SparseNumberVector v1,
SparseNumberVector v2)
Compute the angle for sparse vectors.
|
static double |
angleSparseDense(SparseNumberVector v1,
NumberVector v2)
Compute the angle for a sparse and a dense vector.
|
static double |
cosAngle(NumberVector v1,
NumberVector v2)
Compute the absolute cosine of the angle between two vectors.
|
static double |
dot(NumberVector v1,
NumberVector v2)
Compute the dot product of the angle between two vectors.
|
static double |
dotDense(NumberVector v1,
NumberVector v2)
Compute the dot product of two dense vectors.
|
static double |
dotSparse(SparseNumberVector v1,
SparseNumberVector v2)
Compute the dot product for two sparse vectors.
|
static double |
dotSparseDense(SparseNumberVector v1,
NumberVector v2)
Compute the dot product for a sparse and a dense vector.
|
static double |
minCosAngle(SpatialComparable v1,
SpatialComparable v2)
Compute the minimum angle between two rectangles.
|
static double |
minDot(SpatialComparable v1,
SpatialComparable v2)
Compute the minimum angle between two rectangles, assuming unit length
vectors
|
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,
java.util.Random r)
Produce a new vector based on random numbers in [0:1].
|
private VectorUtil()
public static <V extends NumberVector> V randomVector(NumberVector.Factory<V> factory, int dim, java.util.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 angleDense(NumberVector v1, NumberVector v2)
Math.acos(angle)
!v1
- first vectorv2
- second vectorpublic static double angleSparse(SparseNumberVector v1, SparseNumberVector v2)
v1
- First vectorv2
- Second vectorpublic static double angleSparseDense(SparseNumberVector v1, NumberVector v2)
v1
- Sparse first vectorv2
- Dense second vectorpublic 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 angle(NumberVector v1, NumberVector v2, NumberVector o)
v1
- first vectorv2
- second vectoro
- Originpublic static double dotDense(NumberVector v1, NumberVector v2)
v1
- first vectorv2
- second vectorpublic static double dotSparse(SparseNumberVector v1, SparseNumberVector v2)
v1
- First vectorv2
- Second vectorpublic static double dotSparseDense(SparseNumberVector v1, NumberVector v2)
v1
- Sparse first vectorv2
- Dense second vectorpublic static double dot(NumberVector v1, NumberVector v2)
v1
- first vectorv2
- second vectorpublic static double minDot(SpatialComparable v1, SpatialComparable v2)
v1
- first rectanglev2
- second rectanglepublic 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 © 2019 ELKI Development Team. License information.