Skip to content

Commit

Permalink
clarify relationship between size and copy in RAVV
Browse files Browse the repository at this point in the history
  • Loading branch information
jbellis committed Oct 9, 2023
1 parent d391cce commit 42c96d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public boolean isValueShared() {

@Override
public ListRandomAccessVectorValues copy() {
// our vectorValue is Unshared, but copy anyway in case the underlying List is not threadsafe
return new ListRandomAccessVectorValues(List.copyOf(vectors), dimension);
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@
*/
public interface RandomAccessVectorValues<T> {

/** Return the number of vector values */
/**
* Return the number of vector values.
* <p>
* 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.
*/
int size();

/** Return the dimension of the returned vector values */
Expand Down Expand Up @@ -58,6 +64,8 @@ public interface RandomAccessVectorValues<T> {
* Creates a new copy of this {@link RandomAccessVectorValues}. This is helpful when you need to
* access different values at once, to avoid overwriting the underlying float vector returned by
* a shared {@link RandomAccessVectorValues#vectorValue}.
* <p>
* Un-shared implementations may simply return `this`.
*/
RandomAccessVectorValues<T> copy();
}

0 comments on commit 42c96d9

Please sign in to comment.