Package io.github.jbellis.jvector.graph
Interface RandomAccessVectorValues<T>
- All Known Implementing Classes:
ListRandomAccessVectorValues
public interface RandomAccessVectorValues<T>
Provides random access to vectors by dense ordinal. This interface is used by graph-based
implementations of KNN search.
-
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a new copy of thisRandomAccessVectorValues.intReturn the dimension of the returned vector valuesbooleanintsize()Return the number of vector values.vectorValue(int targetOrd) Return the vector value indexed at the given ordinal.
-
Method Details
-
size
int size()Return the number of vector values.All copies of a given RAVV should have the same size. Typically this is achieved by either (1) implementing a threadsafe, un-shared RAVV, where `copy` returns `this`, or (2) implementing a fixed-size RAVV.
-
dimension
int dimension()Return the dimension of the returned vector values -
vectorValue
Return the vector value indexed at the given ordinal.For performance, implementations are free to re-use the same object across invocations. That is, you will get back the same float[] reference (for instance) for every requested ordinal. If you want to use those values across calls, you should make a copy.
- Parameters:
targetOrd- a valid ordinal, ≥ 0 and <size().
-
copy
RandomAccessVectorValues<T> copy()Creates a new copy of thisRandomAccessVectorValues. This is helpful when you need to access different values at once, to avoid overwriting the underlying float vector returned by a sharedvectorValue(int).Un-shared implementations may simply return `this`.
-