PrintWriter affMatrixWriter = new PrintWriter(affMatrixFile);
// Keep track of the first row and have a reference to the next row.
// The nextRow reference avoid us having to advance into data
// unnecessarily to retrieval the vector for processing to start
SparseDoubleVector curRow = null;
SparseDoubleVector nextRow = null;
SvdlibcSparseBinaryFileRowIterator matrixIter =
new SvdlibcSparseBinaryFileRowIterator(converted);
for (int row = 0; row < rows; ++row) {
LOG.fine("computing affinity for row " + row);
// Loop through each of the rows, gathering the statistics
// necessary to compute the affinity matrix.
for (int other = 0; other < rows; ++other) {
// Special case for the very first row
if (row == 0 && curRow == null) {
curRow = matrixIter.next();
continue;
}
SparseDoubleVector otherRow = matrixIter.next();
// Special case for the similarity threshold, which is
// symmetric. In this case, we can skip over processing any
// rows that occur before the current row
if (other < row)