/** * {@inheritDoc} */ public synchronized void set(int row, int col, double val) { m.set(row, col, val); }
/** * {@inheritDoc} */ public synchronized void set(int row, int col, double val) { m.set(row, col, val); }
/** * {@inheritDoc} */ @Override public void set(int row, int column, double val) { // Swap the ordering so only the upper triangular is written to if (row > column) { int tmp = column; column = row; row = tmp; } backing.set(row, column, val); } }
/** * {@inheritDoc} */ @Override public void set(int row, int column, double val) { // Swap the ordering so only the upper triangular is written to if (row > column) { int tmp = column; column = row; row = tmp; } backing.set(row, column, val); } }
/** * {@inheritDoc} */ public synchronized double addAndGet(int row, int col, double delta) { double value = m.get(row, col) + delta; m.set(row, col, value); return value; }
/** * {@inheritDoc} */ public synchronized double add(int row, int col, double delta) { double value = m.get(row, col); m.set(row, col, value + delta); return value; }
/** * {@inheritDoc} */ public synchronized double getAndAdd(int row, int col, double delta) { double value = m.get(row, col); m.set(row, col, value + delta); return value; }
/** * {@inheritDoc} */ public synchronized double addAndGet(int row, int col, double delta) { double value = m.get(row, col) + delta; m.set(row, col, value); return value; }
/** * Creates a {@code Matrix} from the data encoded as {@link * Format#SVDLIBC_SPARSE_TEXT} in provided file. * * @param matrix * @param matrixType * @param transposeOnRead * * @return a matrix whose data was specified by the provided file */ private static SparseMatrix readMatlabSparse( File matrixFile, Type matrixType, boolean transposeOnRead) throws IOException { SparseMatrix matrix = new GrowingSparseMatrix(); BufferedReader br = new BufferedReader(new FileReader(matrixFile)); for (String line = null; (line = br.readLine()) != null; ) { String[] rowColVal = line.split("\\s+"); int row = Integer.parseInt(rowColVal[0]) - 1; int col = Integer.parseInt(rowColVal[1]) - 1; double value = Double.parseDouble(rowColVal[2]); if (transposeOnRead) matrix.set(col, row, value); else matrix.set(row, col, value); } br.close(); return matrix; }
int nzInCol = dis.readInt(); for (int i = 0; i < nzInCol; ++i, ++entriesSeen) { m.set(dis.readInt(), col, dis.readFloat());