private static void convertSparseDoubleModel(Configuration conf, FSDataOutputStream output, String modelInputDir, ModelLineConvert lineConvert) throws IOException { Int2DoubleOpenHashMap[] data = ModelLoader.loadToDoubleMaps(modelInputDir, conf); for (int i = 0; i < data.length; i++) { Int2DoubleOpenHashMap row = data[i]; data[i] = null; if (row == null) { continue; } lineConvert.convertRowIndex(output, i); int[] indexes = row.keySet().toIntArray(); double[] values = row.values().toDoubleArray(); row = null; Sort.quickSort(indexes, values, 0, indexes.length - 1); for (int j = 0; j < indexes.length; j++) { lineConvert.convertDouble(output, indexes[j], values[j]); } } }