public class SparseDoubleVector extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected int[] |
keys |
protected int |
size |
protected double[] |
values |
Constructor and Description |
---|
SparseDoubleVector() |
SparseDoubleVector(double[] array) |
SparseDoubleVector(HashMap<Integer,Double> hashmap) |
SparseDoubleVector(int size) |
Modifier and Type | Method and Description |
---|---|
double |
cosineSimilarity(SparseDoubleVector other)
Return the cosine similarity between the vectors.
|
double |
dotProduct(double[] other) |
double |
dotProduct(SparseDoubleVector other) |
int |
intersection(SparseDoubleVector other)
Return the number of non-zero values these two vectors have in common, |A
inter B|.
|
double |
jaccard(SparseDoubleVector other)
Computes and return the Jaccard index with other SparseVector.
|
double |
norm()
Compute and return the L2 norm of the vector
|
double |
qgram(SparseDoubleVector other)
Compute and return the qgram similarity with other vector.
|
void |
sampleDIMSUM(double threshold,
int count,
int size) |
int |
size()
Return the number of non-zero elements in this vector.
|
double[] |
toArray(int size)
Return the array corresponding to this sparse vector.
|
String |
toString() |
int |
union(SparseDoubleVector other) |
public SparseDoubleVector(int size)
size
- public SparseDoubleVector()
public SparseDoubleVector(double[] array)
array
- public double dotProduct(SparseDoubleVector other)
other
- public double dotProduct(double[] other)
other
- public double jaccard(SparseDoubleVector other)
other
- public int union(SparseDoubleVector other)
other
- public int intersection(SparseDoubleVector other)
other
- public double qgram(SparseDoubleVector other)
other
- public int size()
public double norm()
public double cosineSimilarity(SparseDoubleVector other)
other
- public void sampleDIMSUM(double threshold, int count, int size)
threshold
- count
- size
- public double[] toArray(int size)
size
- Copyright © 2017. All rights reserved.