Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#INITIAL_COLUMN_AFTER_FINAL_COLUMN
The following examples show how to use
org.apache.commons.math.exception.util.LocalizedFormats#INITIAL_COLUMN_AFTER_FINAL_COLUMN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFieldMatrix.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to n-1. * * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are not valid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ protected void checkSubMatrixIndex(final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(startRow); checkRowIndex(endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, true); } checkColumnIndex(startColumn); checkColumnIndex(endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, true); } }
Example 2
Source File: MatrixUtils.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to {@code n - 1}. * * @param m Matrix. * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are invalid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ public static void checkSubMatrixIndex(final AnyMatrix m, final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(m, startRow); checkRowIndex(m, endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, false); } checkColumnIndex(m, startColumn); checkColumnIndex(m, endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, false); } }
Example 3
Source File: AbstractFieldMatrix.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to n-1. * * @param startRow Initial row index * @param endRow Final row index * @param startColumn Initial column index * @param endColumn Final column index * @exception MatrixIndexException if the indices are not valid */ protected void checkSubMatrixIndex(final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(startRow); checkRowIndex(endRow); if (startRow > endRow) { throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, startRow, endRow); } checkColumnIndex(startColumn); checkColumnIndex(endColumn); if (startColumn > endColumn) { throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, startColumn, endColumn); } }
Example 4
Source File: MatrixUtils.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to n-1. * * @param m matrix containing the submatrix * @param startRow Initial row index * @param endRow Final row index * @param startColumn Initial column index * @param endColumn Final column index * @exception MatrixIndexException if the indices are not valid */ public static void checkSubMatrixIndex(final AnyMatrix m, final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(m, startRow); checkRowIndex(m, endRow); if (startRow > endRow) { throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, startRow, endRow); } checkColumnIndex(m, startColumn); checkColumnIndex(m, endColumn); if (startColumn > endColumn) { throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, startColumn, endColumn); } }
Example 5
Source File: AbstractFieldMatrix.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to n-1. * * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are not valid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ protected void checkSubMatrixIndex(final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(startRow); checkRowIndex(endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, true); } checkColumnIndex(startColumn); checkColumnIndex(endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, true); } }
Example 6
Source File: MatrixUtils.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to {@code n - 1}. * * @param m Matrix. * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are invalid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ public static void checkSubMatrixIndex(final AnyMatrix m, final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(m, startRow); checkRowIndex(m, endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, false); } checkColumnIndex(m, startColumn); checkColumnIndex(m, endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, false); } }
Example 7
Source File: AbstractFieldMatrix.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to n-1. * * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are not valid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ protected void checkSubMatrixIndex(final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(startRow); checkRowIndex(endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, true); } checkColumnIndex(startColumn); checkColumnIndex(endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, true); } }
Example 8
Source File: MatrixUtils.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Check if submatrix ranges indices are valid. * Rows and columns are indicated counting from 0 to {@code n - 1}. * * @param m Matrix. * @param startRow Initial row index. * @param endRow Final row index. * @param startColumn Initial column index. * @param endColumn Final column index. * @throws OutOfRangeException if the indices are invalid. * @throws NumberIsTooSmallException if {@code endRow < startRow} or * {@code endColumn < startColumn}. */ public static void checkSubMatrixIndex(final AnyMatrix m, final int startRow, final int endRow, final int startColumn, final int endColumn) { checkRowIndex(m, startRow); checkRowIndex(m, endRow); if (endRow < startRow) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, endRow, startRow, false); } checkColumnIndex(m, startColumn); checkColumnIndex(m, endColumn); if (endColumn < startColumn) { throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, endColumn, startColumn, false); } }
Example 9
Source File: BigMatrixImpl.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Gets a submatrix. Rows and columns are indicated * counting from 0 to n-1. * * @param startRow Initial row index * @param endRow Final row index * @param startColumn Initial column index * @param endColumn Final column index * @return The subMatrix containing the data of the * specified rows and columns * @exception MatrixIndexException if row or column selections are not valid */ public BigMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn) throws MatrixIndexException { MatrixUtils.checkRowIndex(this, startRow); MatrixUtils.checkRowIndex(this, endRow); if (startRow > endRow) { throw new MatrixIndexException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW, startRow, endRow); } MatrixUtils.checkColumnIndex(this, startColumn); MatrixUtils.checkColumnIndex(this, endColumn); if (startColumn > endColumn) { throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN, startColumn, endColumn); } final BigDecimal[][] subMatrixData = new BigDecimal[endRow - startRow + 1][endColumn - startColumn + 1]; for (int i = startRow; i <= endRow; i++) { System.arraycopy(data[i], startColumn, subMatrixData[i - startRow], 0, endColumn - startColumn + 1); } return new BigMatrixImpl(subMatrixData, false); }