diff --git a/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java index 85aa85c62..1500a8bee 100644 --- a/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java @@ -564,10 +564,16 @@ public abstract class AbstractRealMatrix public abstract void setEntry(int row, int column, double value); /** {@inheritDoc} */ - public abstract void addToEntry(int row, int column, double increment); + public void addToEntry(int row, int column, double increment) { + MatrixUtils.checkMatrixIndex(this, row, column); + setEntry(row, column, getEntry(row, column) + increment); + } /** {@inheritDoc} */ - public abstract void multiplyEntry(int row, int column, double factor); + public void multiplyEntry(int row, int column, double factor) { + MatrixUtils.checkMatrixIndex(this, row, column); + setEntry(row, column, getEntry(row, column) * factor); + } /** {@inheritDoc} */ public RealMatrix transpose() { diff --git a/src/site/xdoc/changes.xml b/src/site/xdoc/changes.xml index 5542670ec..bf13163d4 100644 --- a/src/site/xdoc/changes.xml +++ b/src/site/xdoc/changes.xml @@ -52,6 +52,10 @@ The type attribute can be add,update,fix,remove. If the output is not quite correct, check for invisible trailing spaces! --> + + Default implementation for "addToEntry" and "multiplyEntry" in + "AbstractRealMatrix". + Method "addToEntry" in "RealVector".