fix buffer bug

This commit is contained in:
Jonathan Shook 2023-10-26 18:08:21 -05:00
parent cc5997c1dc
commit 92d62ae88c
2 changed files with 3 additions and 3 deletions

View File

@ -83,11 +83,11 @@ public class FVecReader implements LongFunction<float[]> {
ByteBuffer record = this.bb.get(recpos,buf).order(ByteOrder.LITTLE_ENDIAN);
int recdim = record.getInt();
if(recdim!=dimensions) {
throw new RuntimeException("dimensions are not uniform for ivec file '" + this.path.toString() + "', found dim " + recdim + " at record " + value);
throw new RuntimeException("dimensions are not uniform for fvec file '" + this.path.toString() + "', found dim " + recdim + " at record " + value);
}
float[] data = new float[recdim];
for (int i = 0; i < dimensions; i++) {
data[i]=bb.getFloat();
data[i]=record.getFloat();
}
return data;
}

View File

@ -99,7 +99,7 @@ public class IVecReader implements LongFunction<int[]> {
}
int[] data = new int[recdim];
for (int i = 0; i < dimensions; i++) {
data[i]=Integer.reverseBytes(bb.getInt());
data[i]=Integer.reverseBytes(record.getInt());
}
return data;
}