code: private int computeNearestProductIndex(double[] subvector, int subQuantizerIndex) {
  		int centroidIndex = -1;
  		double minDistance = Double.MAX_VALUE;
  		for (int i = 0; i < numProductCentroids; i++) {
  			double distance = 0;
  			for (int j = 0; j < subVectorLength; j++) {
  				distance += (productQuantizer[subQuantizerIndex][i][j] - subvector[j])
  						* (productQuantizer[subQuantizerIndex][i][j] - subvector[j]);
  				if (distance >= minDistance) {
  					break;
  				}
  			}
  			if (distance < minDistance) {
  				minDistance = distance;
  				centroidIndex = i;
  			}
  		}
  		return centroidIndex;
  	}
docs: Finds and returns the index of the centroid of the subquantizer with the given index which is closer to
  the given subvector.
  
  @param subvector
  The subvector
  @param subQuantizerIndex
  The index of the the subquantizer
  @return The index of the nearest centroid