public final class Vectors
extends java.lang.Object
Compatibility: Public
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Iterable<org.apache.commons.lang3.tuple.Pair<VectorEntry,VectorEntry>> |
fastIntersect(SparseVector v1,
SparseVector v2)
Iterate over the intersection of two vectors without the overhead of object creation.
|
static MutableSparseVector |
fromArray(IdIndexMapping map,
double[] values)
Create a mutable sparse vector from an array and index mapping.
|
static MutableSparseVector |
fromScoredIds(java.util.List<ScoredId> scores) |
static java.lang.Iterable<org.apache.commons.lang3.tuple.ImmutablePair<VectorEntry,VectorEntry>> |
intersect(SparseVector v1,
SparseVector v2)
Iterate over the intersection of two vectors - they keys they have in common.
|
public static MutableSparseVector fromScoredIds(java.util.List<ScoredId> scores)
public static MutableSparseVector fromArray(IdIndexMapping map, double[] values)
map - The index mapping specifying the keys.values - The array of values.map to the values in values.java.lang.IllegalArgumentException - if values not the same size as map.public static java.lang.Iterable<org.apache.commons.lang3.tuple.ImmutablePair<VectorEntry,VectorEntry>> intersect(SparseVector v1, SparseVector v2)
v1 - The first vector.v2 - The second vector.public static java.lang.Iterable<org.apache.commons.lang3.tuple.Pair<VectorEntry,VectorEntry>> fastIntersect(SparseVector v1, SparseVector v2)
v1 - The first vector.v2 - The second vector.intersect(SparseVector, SparseVector)