function closestCentroid( dist, k, ndims, C, strideC, offsetC, V, strideV, offsetV ) { // eslint-disable-line max-len
	var cd;
	var c;
	var d;
	var i;

	cd = PINF;
	for ( i = 0; i < k; i++ ) {
		// Why the magic number `1`? Because we know that the centroids matrix should be row-major single-segment contiguous.
		d = dist( ndims, C, 1, offsetC, V, strideV, offsetV );
		if ( d < cd ) {
			cd = d;
			c = i;
		}
		offsetC += strideC;
	}
	return c;
}
Finds the closest centroid.

@private
@param {Function} dist - distance function
@param {PositiveInteger} k - number of clusters
@param {PositiveInteger} ndims - number of dimensions
@param {NumericArray} C - strided array containing centroids
@param {PositiveInteger} strideC - centroid row stride
@param {NonNegativeInteger} offsetC - centroid index offset
@param {NumericArray} V - strided array containing a data point
@param {integer} strideV - vector stride
@param {NonNegativeInteger} offsetV - vector index offset
@returns {NonNegativeInteger} centroid index