double similarityValue = similarity.similarity(rowA, rowB, cooccurrences, rowPair.getWeightA(),
rowPair.getWeightB(), numberOfColumns);
if (!Double.isNaN(similarityValue)) {
SimilarityMatrixEntryKey key = new SimilarityMatrixEntryKey();
MatrixEntryWritable entry = new MatrixEntryWritable();
entry.setVal(similarityValue);
entry.setRow(rowA);
entry.setCol(rowB);
key.set(rowA, similarityValue);
ctx.write(key, entry);
if (rowA != rowB) {
entry.setRow(rowB);
entry.setCol(rowA);
key.set(rowB, similarityValue);
ctx.write(key, entry);
}
}
}