File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
jvector-base/src/main/java/io/github/jbellis/jvector/quantization Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -48,15 +48,17 @@ public MutablePQVectors(ProductQuantization pq) {
4848 @ Override
4949 public void encodeAndSet (int ordinal , VectorFloat <?> vector ) {
5050 ensureChunkCapacity (ordinal );
51- pq . encodeTo ( vector , get (ordinal ));
51+ // increase count first so get() works
5252 vectorCount .updateAndGet (current -> max (current , ordinal + 1 ));
53+ pq .encodeTo (vector , get (ordinal ));
5354 }
5455
5556 @ Override
5657 public void setZero (int ordinal ) {
5758 ensureChunkCapacity (ordinal );
58- get (ordinal ). zero ();
59+ // increase count first so get() works
5960 vectorCount .updateAndGet (current -> max (current , ordinal + 1 ));
61+ get (ordinal ).zero ();
6062 }
6163
6264 private void ensureChunkCapacity (int ordinal ) {
You can’t perform that action at this time.
0 commit comments