final long itemId1 = outer.nextLong();
if (logger.isTraceEnabled()) {
logger.trace("computing similarities for item {} ({} of {})",
itemId1, ndone, nitems);
}
SparseVector vec1 = buildContext.itemVector(itemId1);
LongIterator itemIter = neighborStrategy.neighborIterator(buildContext, itemId1,
itemSimilarity.isSymmetric());
ScoredItemAccumulator row = rows.get(itemId1);
while (itemIter.hasNext()) {
long itemId2 = itemIter.nextLong();
if (itemId1 != itemId2) {
SparseVector vec2 = buildContext.itemVector(itemId2);
double sim = itemSimilarity.similarity(itemId1, vec1, itemId2, vec2);
if (threshold.retain(sim)) {
row.put(itemId2, sim);
if (itemSimilarity.isSymmetric()) {
rows.get(itemId2).put(itemId1, sim);