/** {@inheritDoc} */ public void setEntry(int index, double value) throws MatrixIndexException { checkIndex(index); if (!isDefaultValue(value)) { entries.put(index, value); } else if (entries.containsKey(index)) { entries.remove(index); } }
/** {@inheritDoc} */ public void setEntry(int index, double value) throws MatrixIndexException { checkIndex(index); if (!isDefaultValue(value)) { entries.put(index, value); } else if (entries.containsKey(index)) { entries.remove(index); } }
/** {@inheritDoc} */ @Override public void setEntry(int row, int column, double value) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); if (value == 0.0) { entries.remove(computeKey(row, column)); } else { entries.put(computeKey(row, column), value); } }
/** {@inheritDoc} */ @Override public void setEntry(int row, int column, double value) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); if (value == 0.0) { entries.remove(computeKey(row, column)); } else { entries.put(computeKey(row, column), value); } }
/** {@inheritDoc} */ @Override public void addToEntry(int row, int column, double increment) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); final int key = computeKey(row, column); final double value = entries.get(key) + increment; if (value == 0.0) { entries.remove(key); } else { entries.put(key, value); } }
/** {@inheritDoc} */ @Override public void multiplyEntry(int row, int column, double factor) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); final int key = computeKey(row, column); final double value = entries.get(key) * factor; if (value == 0.0) { entries.remove(key); } else { entries.put(key, value); } }
/** {@inheritDoc} */ @Override public void multiplyEntry(int row, int column, double factor) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); final int key = computeKey(row, column); final double value = entries.get(key) * factor; if (value == 0.0) { entries.remove(key); } else { entries.put(key, value); } }
/** {@inheritDoc} */ @Override public void addToEntry(int row, int column, double increment) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, row); MatrixUtils.checkColumnIndex(this, column); final int key = computeKey(row, column); final double value = entries.get(key) + increment; if (value == 0.0) { entries.remove(key); } else { entries.put(key, value); } }
out.entries.get(outKey) + value * m.entries.get(rightKey); if (outValue == 0.0) { out.entries.remove(outKey); } else { out.entries.put(outKey, outValue);
out.entries.get(outKey) + value * m.entries.get(rightKey); if (outValue == 0.0) { out.entries.remove(outKey); } else { out.entries.put(outKey, outValue);