/** {@inheritDoc} */
  public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
      throws NoDataException, OutOfRangeException, DimensionMismatchException,
          NullArgumentException {
    MathUtils.checkNotNull(subMatrix);
    final int nRows = subMatrix.length;
    if (nRows == 0) {
      throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
    }

    final int nCols = subMatrix[0].length;
    if (nCols == 0) {
      throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
    }

    for (int r = 1; r < nRows; ++r) {
      if (subMatrix[r].length != nCols) {
        throw new DimensionMismatchException(nCols, subMatrix[r].length);
      }
    }

    MatrixUtils.checkRowIndex(this, row);
    MatrixUtils.checkColumnIndex(this, column);
    MatrixUtils.checkRowIndex(this, nRows + row - 1);
    MatrixUtils.checkColumnIndex(this, nCols + column - 1);

    for (int i = 0; i < nRows; ++i) {
      for (int j = 0; j < nCols; ++j) {
        setEntry(row + i, column + j, subMatrix[i][j]);
      }
    }
  }
 /** {@inheritDoc} */
 public void setColumn(final int column, final double[] array) {
   MatrixUtils.checkColumnIndex(this, column);
   final int nRows = getRowDimension();
   if (array.length != nRows) {
     throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
   }
   for (int i = 0; i < nRows; ++i) {
     setEntry(i, column, array[i]);
   }
 }
 /** {@inheritDoc} */
 public void setRow(final int row, final double[] array) {
   MatrixUtils.checkRowIndex(this, row);
   final int nCols = getColumnDimension();
   if (array.length != nCols) {
     throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
   }
   for (int i = 0; i < nCols; ++i) {
     setEntry(row, i, array[i]);
   }
 }
 /** {@inheritDoc} */
 public void setColumnVector(final int column, final RealVector vector) {
   MatrixUtils.checkColumnIndex(this, column);
   final int nRows = getRowDimension();
   if (vector.getDimension() != nRows) {
     throw new MatrixDimensionMismatchException(vector.getDimension(), 1, nRows, 1);
   }
   for (int i = 0; i < nRows; ++i) {
     setEntry(i, column, vector.getEntry(i));
   }
 }
 /** {@inheritDoc} */
 public void setRowVector(final int row, final RealVector vector) {
   MatrixUtils.checkRowIndex(this, row);
   final int nCols = getColumnDimension();
   if (vector.getDimension() != nCols) {
     throw new MatrixDimensionMismatchException(1, vector.getDimension(), 1, nCols);
   }
   for (int i = 0; i < nCols; ++i) {
     setEntry(row, i, vector.getEntry(i));
   }
 }
 /** {@inheritDoc} */
 public void setColumnMatrix(final int column, final RealMatrix matrix) {
   MatrixUtils.checkColumnIndex(this, column);
   final int nRows = getRowDimension();
   if ((matrix.getRowDimension() != nRows) || (matrix.getColumnDimension() != 1)) {
     throw new MatrixDimensionMismatchException(
         matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
   }
   for (int i = 0; i < nRows; ++i) {
     setEntry(i, column, matrix.getEntry(i, 0));
   }
 }
 /** {@inheritDoc} */
 public void setRowMatrix(final int row, final RealMatrix matrix) {
   MatrixUtils.checkRowIndex(this, row);
   final int nCols = getColumnDimension();
   if ((matrix.getRowDimension() != 1) || (matrix.getColumnDimension() != nCols)) {
     throw new MatrixDimensionMismatchException(
         matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
   }
   for (int i = 0; i < nCols; ++i) {
     setEntry(row, i, matrix.getEntry(0, i));
   }
 }
 /** {@inheritDoc} */
 public double walkInColumnOrder(final RealMatrixChangingVisitor visitor) {
   final int rows = getRowDimension();
   final int columns = getColumnDimension();
   visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
   for (int column = 0; column < columns; ++column) {
     for (int row = 0; row < rows; ++row) {
       final double oldValue = getEntry(row, column);
       final double newValue = visitor.visit(row, column, oldValue);
       setEntry(row, column, newValue);
     }
   }
   return visitor.end();
 }
 /** {@inheritDoc} */
 public double walkInColumnOrder(
     final RealMatrixChangingVisitor visitor,
     final int startRow,
     final int endRow,
     final int startColumn,
     final int endColumn) {
   MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
   visitor.start(
       getRowDimension(), getColumnDimension(), startRow, endRow, startColumn, endColumn);
   for (int column = startColumn; column <= endColumn; ++column) {
     for (int row = startRow; row <= endRow; ++row) {
       final double oldValue = getEntry(row, column);
       final double newValue = visitor.visit(row, column, oldValue);
       setEntry(row, column, newValue);
     }
   }
   return visitor.end();
 }
 /** {@inheritDoc} */
 public void multiplyEntry(int row, int column, double factor) throws OutOfRangeException {
   MatrixUtils.checkMatrixIndex(this, row, column);
   setEntry(row, column, getEntry(row, column) * factor);
 }
 /** {@inheritDoc} */
 public void addToEntry(int row, int column, double increment) throws OutOfRangeException {
   MatrixUtils.checkMatrixIndex(this, row, column);
   setEntry(row, column, getEntry(row, column) + increment);
 }
 /** {@inheritDoc} */
 public void multiplyEntry(int row, int column, double factor) {
   MatrixUtils.checkMatrixIndex(this, row, column);
   setEntry(row, column, getEntry(row, column) * factor);
 }
 /** {@inheritDoc} */
 public void addToEntry(int row, int column, double increment) {
   MatrixUtils.checkMatrixIndex(this, row, column);
   setEntry(row, column, getEntry(row, column) + increment);
 }