@Override
public double getSimilarity(FastIDSet cluster1, FastIDSet cluster2) throws TasteException {
if (cluster1.isEmpty() || cluster2.isEmpty()) {
return Double.NaN;
}
LongPrimitiveIterator someUsers = SamplingLongPrimitiveIterator.maybeWrapIterator(cluster1.iterator(),
samplingRate);
double greatestSimilarity = Double.NEGATIVE_INFINITY;
while (someUsers.hasNext()) {
long userID1 = someUsers.next();
LongPrimitiveIterator it2 = cluster2.iterator();
while (it2.hasNext()) {
double theSimilarity = similarity.userSimilarity(userID1, it2.next());
if (theSimilarity > greatestSimilarity) {
greatestSimilarity = theSimilarity;
}
}
}