in src/main/java/com/twitter/sbf/app/Main.java [208:225]
private static void writeRowsWithScores(
SparseRealMatrix z,
PrintWriter writer
) throws IOException {
for (int i = 0; i < z.getNumRows(); i++) {
int[] rowWithIndices = z.getColIdsForRow(i);
double[] rowWithScores = z.getValuesForRow(i);
for (int j = 0; j < rowWithIndices.length; j++) {
if (j > 0) {
writer.print(" ");
}
// Add 1 to get back 1-indexing
writer.print(String.format("%d:%.2g", rowWithIndices[j] + 1, rowWithScores[j]));
}
writer.println();
}
writer.close();
}