Skip to content

Commit 4cd94cf

Browse files
committed
missed a few short to int in tests
1 parent 6cda6a6 commit 4cd94cf

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

server/src/test/java/org/elasticsearch/index/codec/vectors/cluster/HierarchicalKMeansTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void testHKmeans() throws IOException {
2323
int dims = random().nextInt(2, 20);
2424
int sampleSize = random().nextInt(100, nVectors);
2525
int maxIterations = random().nextInt(0, 100);
26-
short clustersPerNeighborhood = (short) random().nextInt(0, 512);
26+
int clustersPerNeighborhood = random().nextInt(0, 512);
2727
FloatVectorValues vectors = generateData(nVectors, dims, nClusters);
2828

2929
int targetSize = (int) ((float) nVectors / (float) nClusters);
@@ -32,8 +32,8 @@ public void testHKmeans() throws IOException {
3232
KMeansResult result = hkmeans.cluster(vectors, targetSize);
3333

3434
float[][] centroids = result.centroids();
35-
short[] assignments = result.assignments();
36-
short[] soarAssignments = result.soarAssignments();
35+
int[] assignments = result.assignments();
36+
int[] soarAssignments = result.soarAssignments();
3737

3838
assertEquals(nClusters, centroids.length, 5);
3939
assertEquals(nVectors, assignments.length);

server/src/test/java/org/elasticsearch/index/codec/vectors/cluster/KMeansLocalTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void testKMeansLocal() throws IOException {
2525
int dims = random().nextInt(2, 20);
2626
int sampleSize = random().nextInt(100, nVectors);
2727
int maxIterations = random().nextInt(0, 100);
28-
short clustersPerNeighborhood = (short) random().nextInt(0, 512);
28+
int clustersPerNeighborhood = random().nextInt(0, 512);
2929
FloatVectorValues vectors = generateData(nVectors, dims, nClusters);
3030

3131
float[][] centroids = KMeans.pickInitialCentroids(vectors, nClusters);
@@ -35,8 +35,8 @@ public void testKMeansLocal() throws IOException {
3535
int[] assignmentOrdinals = new int[vectors.size()];
3636
for (int i = 0; i < vectors.size(); i++) {
3737
float minDist = Float.MAX_VALUE;
38-
short ord = -1;
39-
for (short j = 0; j < centroids.length; j++) {
38+
int ord = -1;
39+
for (int j = 0; j < centroids.length; j++) {
4040
float dist = VectorUtil.squareDistance(vectors.vectorValue(i), centroids[j]);
4141
if (dist < minDist) {
4242
minDist = dist;
@@ -58,7 +58,7 @@ public void testKMeansLocal() throws IOException {
5858
public void testKMeansLocalAllZero() throws IOException {
5959
int nClusters = 10;
6060
int maxIterations = 10;
61-
short clustersPerNeighborhood = 128;
61+
int clustersPerNeighborhood = 128;
6262
int nVectors = 1000;
6363
List<float[]> vectors = new ArrayList<>();
6464
for (int i = 0; i < nVectors; i++) {
@@ -75,8 +75,8 @@ public void testKMeansLocalAllZero() throws IOException {
7575
int[] assignmentOrdinals = new int[vectors.size()];
7676
for (int i = 0; i < vectors.size(); i++) {
7777
float minDist = Float.MAX_VALUE;
78-
short ord = -1;
79-
for (short j = 0; j < centroids.length; j++) {
78+
int ord = -1;
79+
for (int j = 0; j < centroids.length; j++) {
8080
float dist = VectorUtil.squareDistance(fvv.vectorValue(i), centroids[j]);
8181
if (dist < minDist) {
8282
minDist = dist;

0 commit comments

Comments
 (0)