public class SparseIntegerVector extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected int[] |
keys |
protected int |
size |
protected int[] |
values |
Constructor and Description |
---|
SparseIntegerVector() |
SparseIntegerVector(HashMap<Integer,Integer> hashmap) |
SparseIntegerVector(int size) |
SparseIntegerVector(int[] array) |
Modifier and Type | Method and Description |
---|---|
double |
cosineSimilarity(SparseIntegerVector other) |
double |
dotProduct(double[] other) |
double |
dotProduct(SparseIntegerVector other) |
int |
intersection(SparseIntegerVector other) |
double |
jaccard(SparseIntegerVector other)
Computes and return the Jaccard index with other SparseVector.
|
double |
norm()
Compute and return the L2 norm of the vector
|
double |
qgram(SparseIntegerVector other)
Compute and return the qgram similarity with other vector.
|
int |
size()
Return the number of (non-zero) elements in this vector.
|
String |
toString() |
int |
union(SparseIntegerVector other) |
public SparseIntegerVector(int size)
public SparseIntegerVector()
public SparseIntegerVector(int[] array)
array
- public double cosineSimilarity(SparseIntegerVector other)
public double dotProduct(SparseIntegerVector other)
other
- public double dotProduct(double[] other)
public double norm()
public double jaccard(SparseIntegerVector other)
other
- public int union(SparseIntegerVector other)
other
- public int intersection(SparseIntegerVector other)
other
- public double qgram(SparseIntegerVector other)
other
- public int size()
Copyright © 2015. All rights reserved.