@@ -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