private int hash16DotProduct(int bucket,HashEntry[] vec,int hashcur)

	{
		int i, j;
		int rowNum;
		int signPtr;

		for (i = 0; i < 16; ++i)
			doubleBuffer[i] = 0.0;							// Initialize the dotproduct results to zero

		if (vec.length < VEC_SIZE_UPPER) {					// If there are a small number of non-zero coefficients in -vec-
			for (i = 0; i < vec.length; ++i) {
				rowNum = vec[i].getHash() ^ hashcur;		// Calculate the rest of the r_0 hashing function
				rowNum = (rowNum * HASH_MULTIPLIER) + HASH_ADDEND;
				rowNum = (rowNum >>> 24) & 0x1f;
				signPtr = rowNum * 16;
				for (j = 0; j < 16; ++j) {				// Based on the precalculated coeff table calculate this portion of dotproduct
					if (hashSignTable[signPtr + j] == '+')
						doubleBuffer[j] += vec[i].getCoeff(); // Dot product with +1 // coeff
					else
						doubleBuffer[j] -= vec[i].getCoeff(); // Dot product with -1 // coeff
				}
			}
		}
		else {											// If we have many non-zero coefficients in -vec-
			for (i = 0; i < vec.length; ++i) {
				rowNum = vec[i].getHash() ^ hashcur;	// Calculate the rest of the r_0 hashing function
				rowNum = (rowNum * HASH_MULTIPLIER) + HASH_ADDEND;
				rowNum = (rowNum >>> 24) & 0x1f;
				if (rowNum < 0x10) // Set-up for the FFT
					doubleBuffer[rowNum] += vec[i].getCoeff();
				else
					doubleBuffer[rowNum & 0xf] -= vec[i].getCoeff();
			}
			hashFft16(doubleBuffer);					// Calculate the remaining dot-products be performing FFT
		}

		for (i = 0; i < 16; ++i) {						// Convert the dot-product results to a bit-vector
			bucket <<= 1;
			if (doubleBuffer[i] > 0.0)
				bucket |= 1;
		}
		return bucket;
	}
Generate a dot product of the hash vector in -vec- with a random family of 16 vectors, { r }
r_0 is a randomly generated set of +1 -1 coefficients across all the dimensions (indexed by uint32 vec[i].hash)
  The coefficient is calculated as a hashing function from the seed -hashcur- and the index (vec[i].hash),
  so it should be balanced between +1 and -1.
All the other vectors are generated from an FFT of r_0.  This allows the dotproduct with vec to be calculated
  using an FFT if -vec- has many non-zero coefficients.  If -vec- has only a few non-zero coefficients,
  the dotproduct if calculated with each vector in the family directly for better efficiency.
The resulting dotproducts are converted into a 16-long bitvector based on the sign of the dotproduct and
  placed in -bucket-
@param bucket is the (possibly partially filled) accumulator for dotproduct bits
@param vec is the HashEntry vector to calculate the dot-products on
@param hashcur is the index of the hash subfamily to representing r_0
@param res is space (a 16-long double array) for the in-place FFT
@return the bucket with new accumulated dot-product bits
Ghidra/Extensions/BSimElasticPlugin/src/org/elasticsearch/plugin/analysis/lsh/LSHBinner.java