/** Construct a sparse matrix with both CRS and CCS structures */ public SparseMatrix( int rows, int cols, Table<Integer, Integer, Double> dataTable, Multimap<Integer, Integer> colMap) { numRows = rows; numColumns = cols; construct(dataTable, colMap); }
/** * Construct a sparse matrix with CRS structures (CCS structure optional). * * @deprecated I don't recommend to use this method as it (takes time and) is better to constructe * the column structure at the time when you construct the row structure (of data table). This * method is put here (as an example) to show how to construct column structure according to * the data table. */ public SparseMatrix( int rows, int cols, Table<Integer, Integer, Double> dataTable, boolean isCCSUsed) { numRows = rows; numColumns = cols; Multimap<Integer, Integer> colMap = null; if (isCCSUsed) { colMap = HashMultimap.create(); for (Cell<Integer, Integer, Double> cell : dataTable.cellSet()) colMap.put(cell.getColumnKey(), cell.getRowKey()); } construct(dataTable, colMap); }