public class VectorArray<V extends Vec> extends ArrayList<V> implements IncrementalCollection<V>
acceleration cache
Modifier and Type | Class and Description |
---|---|
static class |
VectorArray.VectorArrayFactory<V extends Vec> |
modCount
Constructor and Description |
---|
VectorArray(DistanceMetric distanceMetric) |
VectorArray(DistanceMetric distanceMetric,
Collection<? extends V> c) |
VectorArray(DistanceMetric distanceMetric,
int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(V e) |
boolean |
addAll(Collection<? extends V> c) |
VectorArray<V> |
clone() |
DistanceMetric |
getDistanceMetric() |
void |
insert(V x)
Incrementally adds the given datapoint into the collection
|
V |
remove(int index) |
List<? extends VecPaired<V,Double>> |
search(Vec query,
double range)
Searches the space for all vectors that are within a given range of the query vector.
|
List<? extends VecPaired<V,Double>> |
search(Vec query,
int neighbors)
Searches the space for the k neighbors that are closest to the given query vector
|
void |
setDistanceMetric(DistanceMetric distanceMetric) |
add, addAll, clear, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
size
containsAll, equals, hashCode
parallelStream, stream
public VectorArray(DistanceMetric distanceMetric, int initialCapacity)
public VectorArray(DistanceMetric distanceMetric, Collection<? extends V> c)
public VectorArray(DistanceMetric distanceMetric)
public DistanceMetric getDistanceMetric()
public void setDistanceMetric(DistanceMetric distanceMetric)
public void insert(V x)
IncrementalCollection
insert
in interface IncrementalCollection<V extends Vec>
x
- the vector to add to the collectionpublic boolean add(V e)
public boolean addAll(Collection<? extends V> c)
public V remove(int index)
public List<? extends VecPaired<V,Double>> search(Vec query, double range)
VectorCollection
search
in interface VectorCollection<V extends Vec>
query
- the vector we want to find others nearrange
- the search range around our querypublic List<? extends VecPaired<V,Double>> search(Vec query, int neighbors)
VectorCollection
search
in interface VectorCollection<V extends Vec>
query
- the vector we want to find neighbors ofneighbors
- the maximum number of neighbors to returnpublic VectorArray<V> clone()
Copyright © 2017. All rights reserved.