/** {@inheritDoc} */ @Override public void setEntry(final int row, final int column, final double value) throws MatrixIndexException { try { data[row][column] = value; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void setEntry(final int row, final int column, final double value) throws MatrixIndexException { try { data[row][column] = value; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void multiplyEntry(final int row, final int column, final double factor) throws MatrixIndexException { try { data[row][column] *= factor; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** * Check if an index is valid. * @param index index to check * @exception MatrixIndexException if index is not valid */ protected void checkIndex(final int index) throws MatrixIndexException { if (index < 0 || index >= getDimension()) { throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE, index, 0, getDimension() - 1); } }
/** {@inheritDoc} */ @Override public T getEntry(final int row, final int column) throws MatrixIndexException { try { return data[row][column]; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void setEntry(final int row, final int column, final T value) throws MatrixIndexException { try { data[row][column] = value; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** * Check if an index is valid. * @param index index to check * @exception MatrixIndexException if index is not valid */ private void checkIndex(final int index) throws MatrixIndexException { if (index < 0 || index >= getDimension()) { throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE, index, 0, getDimension() - 1); } }
/** {@inheritDoc} */ @Override public void multiplyEntry(final int row, final int column, final double factor) throws MatrixIndexException { try { data[row][column] *= factor; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( "no entry at indices ({0}, {1}) in a {2}x{3} matrix", row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public double getEntry(final int row, final int column) throws MatrixIndexException { try { return data[row][column]; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void addToEntry(final int row, final int column, final double increment) throws MatrixIndexException { try { data[row][column] += increment; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension()); } }
/** * Check if a row index is valid. * @param m matrix containing the submatrix * @param row row index to check * @exception MatrixIndexException if index is not valid */ public static void checkRowIndex(final AnyMatrix m, final int row) { if (row < 0 || row >= m.getRowDimension()) { throw new MatrixIndexException("row index {0} out of allowed range [{1}, {2}]", row, 0, m.getRowDimension() - 1); } }
/** {@inheritDoc} */ @Override public void setEntry(final int row, final int column, final double value) throws MatrixIndexException { try { data[row][column] = value; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( NO_ENTRY_MESSAGE, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public double getEntry(final int row, final int column) throws MatrixIndexException { try { return data[row][column]; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( "no entry at indices ({0}, {1}) in a {2}x{3} matrix", row, column, getRowDimension(), getColumnDimension()); } }
/** * Check if a column index is valid. * @param m matrix containing the submatrix * @param column column index to check * @exception MatrixIndexException if index is not valid */ public static void checkColumnIndex(final AnyMatrix m, final int column) throws MatrixIndexException { if (column < 0 || column >= m.getColumnDimension()) { throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE, column, 0, m.getColumnDimension() - 1); } }
/** {@inheritDoc} */ @Override public double getEntry(final int row, final int column) throws MatrixIndexException { try { return data[row][column]; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void addToEntry(final int row, final int column, final double increment) throws MatrixIndexException { try { data[row][column] += increment; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** {@inheritDoc} */ @Override public void multiplyEntry(final int row, final int column, final double factor) throws MatrixIndexException { try { data[row][column] *= factor; } catch (ArrayIndexOutOfBoundsException e) { throw new MatrixIndexException( LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension()); } }
/** * Check if a row index is valid. * @param row row index to check * @exception MatrixIndexException if index is not valid */ protected void checkRowIndex(final int row) { if (row < 0 || row >= getRowDimension()) { throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE, row, 0, getRowDimension() - 1); } }
/** * Check if a column index is valid. * @param column column index to check * @exception MatrixIndexException if index is not valid */ protected void checkColumnIndex(final int column) throws MatrixIndexException { if (column < 0 || column >= getColumnDimension()) { throw new MatrixIndexException(LocalizedFormats.COLUMN_INDEX_OUT_OF_RANGE, column, 0, getColumnDimension() - 1); } }
/** * Check if a row index is valid. * @param m matrix containing the submatrix * @param row row index to check * @exception MatrixIndexException if index is not valid */ public static void checkRowIndex(final AnyMatrix m, final int row) { if (row < 0 || row >= m.getRowDimension()) { throw new MatrixIndexException(LocalizedFormats.ROW_INDEX_OUT_OF_RANGE, row, 0, m.getRowDimension() - 1); } }