/// <inheritdoc/>
 public override void setEntry(int row, int column, double value)
 {
     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/>
        public double[] getColumn(int column)
        {
            MatrixUtils.checkColumnIndex(this, column);
            int nRows = getRowDimension();

            double[] outp = new double[nRows];
            for (int i = 0; i < nRows; ++i)
            {
                outp[i] = getEntry(i, column);
            }

            return(outp);
        }
        /// <inheritdoc/>
        public RealMatrix getColumnMatrix(int column)
        {
            MatrixUtils.checkColumnIndex(this, column);
            int        nRows = getRowDimension();
            RealMatrix outp  = createMatrix(nRows, 1);

            for (int i = 0; i < nRows; ++i)
            {
                outp.setEntry(i, 0, getEntry(i, column));
            }

            return(outp);
        }
        /// <inheritdoc/>
        public void setColumn(int column, double[] array)
        {
            MatrixUtils.checkColumnIndex(this, column);
            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 setColumnVector(int column, RealVector vector)
        {
            MatrixUtils.checkColumnIndex(this, column);
            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 new void multiplyEntry(int row, int column, double factor)
        {
            MatrixUtils.checkRowIndex(this, row);
            MatrixUtils.checkColumnIndex(this, column);
            int    key   = computeKey(row, column);
            double value = entries.get(key) * factor;

            if (value == 0.0)
            {
                entries.remove(key);
            }
            else
            {
                entries.put(key, value);
            }
        }
        /// <inheritdoc/>
        public new void addToEntry(int row, int column, double increment)
        {
            MatrixUtils.checkRowIndex(this, row);
            MatrixUtils.checkColumnIndex(this, column);
            int    key   = computeKey(row, column);
            double value = entries.get(key) + increment;

            if (value == 0.0)
            {
                entries.remove(key);
            }
            else
            {
                entries.put(key, value);
            }
        }
        /// <inheritdoc/>
        public void setColumnMatrix(int column, RealMatrix matrix)
        {
            MatrixUtils.checkColumnIndex(this, column);
            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 setSubMatrix(double[][] subMatrix, int row, int column)
        {
            MathUtils.checkNotNull(subMatrix);
            int nRows = subMatrix.Length;

            if (nRows == 0)
            {
                throw new NoDataException(new LocalizedFormats("AT_LEAST_ONE_ROW"));
            }

            int nCols = subMatrix[0].Length;

            if (nCols == 0)
            {
                throw new NoDataException(new 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 override double getEntry(int row, int column)
 {
     MatrixUtils.checkRowIndex(this, row);
     MatrixUtils.checkColumnIndex(this, column);
     return(entries.get(computeKey(row, column)));
 }