Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#INITIAL_ROW_AFTER_FINAL_ROW

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#INITIAL_ROW_AFTER_FINAL_ROW . 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: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 */
protected void checkIndices(final int start, final int end) {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 2
Source File: AbstractFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 3
Source File: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.1
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 4
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 5
Source File: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.1
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 6
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 vote down vote up
/**
 * 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: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.1
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 9
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 10
Source File: ArrayFieldVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.3
 */
private void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 11
Source File: AbstractFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 12
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 13
Source File: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.1
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 14
Source File: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 15
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 16
Source File: AbstractFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 17
Source File: RealVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.1
 */
protected void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        // TODO Use more specific error message
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 18
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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 19
Source File: ArrayFieldVector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that the indices of a subvector are valid.
 *
 * @param start the index of the first entry of the subvector
 * @param end the index of the last entry of the subvector (inclusive)
 * @throws OutOfRangeException if {@code start} of {@code end} are not valid
 * @throws NumberIsTooSmallException if {@code end < start}
 * @since 3.3
 */
private void checkIndices(final int start, final int end)
    throws NumberIsTooSmallException, OutOfRangeException {
    final int dim = getDimension();
    if ((start < 0) || (start >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
                                      dim - 1);
    }
    if ((end < 0) || (end >= dim)) {
        throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
                                      dim - 1);
    }
    if (end < start) {
        throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
                                            end, start, false);
    }
}
 
Example 20
Source File: MatrixUtils.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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)
    throws NumberIsTooSmallException, OutOfRangeException {
    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);
    }


}