Java Code Examples for org.apache.commons.math.exception.util.LocalizedFormats#NO_SUCH_MATRIX_ENTRY

The following examples show how to use org.apache.commons.math.exception.util.LocalizedFormats#NO_SUCH_MATRIX_ENTRY . 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: BlockFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void addToEntry(final int row, final int column, final T increment)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
        blockIJ[k] = blockIJ[k].add(increment);
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 2
Source File: BlockFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void setEntry(final int row, final int column, final T value)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        blocks[iBlock * blockColumns + jBlock][k] = value;
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 3
Source File: BlockFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public T getEntry(final int row, final int column)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        return blocks[iBlock * blockColumns + jBlock][k];
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 4
Source File: BlockRealMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void multiplyEntry(final int row, final int column, final double factor)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        blocks[iBlock * blockColumns + jBlock][k] *= factor;
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 5
Source File: BlockRealMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void addToEntry(final int row, final int column, final double increment)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        blocks[iBlock * blockColumns + jBlock][k] += increment;
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 6
Source File: BlockRealMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void setEntry(final int row, final int column, final double value)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        blocks[iBlock * blockColumns + jBlock][k] = value;
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 7
Source File: BlockRealMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public double getEntry(final int row, final int column)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        return blocks[iBlock * blockColumns + jBlock][k];
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 8
Source File: BlockFieldMatrix.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void multiplyEntry(final int row, final int column, final T factor)
    throws MatrixIndexException {
    try {
        final int iBlock = row    / BLOCK_SIZE;
        final int jBlock = column / BLOCK_SIZE;
        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
                           (column - jBlock * BLOCK_SIZE);
        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
        blockIJ[k] = blockIJ[k].multiply(factor);
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 9
Source File: Array2DRowRealMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 10
Source File: Array2DRowRealMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 11
Source File: Array2DRowRealMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 12
Source File: RealMatrixImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 13
Source File: RealMatrixImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 14
Source File: RealMatrixImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 15
Source File: RealMatrixImpl.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 16
Source File: Array2DRowFieldMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void multiplyEntry(final int row, final int column, final T factor)
    throws MatrixIndexException {
    try {
        data[row][column] = data[row][column].multiply(factor);
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                  LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 17
Source File: Array2DRowFieldMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void addToEntry(final int row, final int column, final T increment)
    throws MatrixIndexException {
    try {
        data[row][column] = data[row][column].add(increment);
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                  LocalizedFormats.NO_SUCH_MATRIX_ENTRY, row, column, getRowDimension(), getColumnDimension());
    }
}
 
Example 18
Source File: Array2DRowFieldMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 19
Source File: Array2DRowFieldMatrix.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@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());
    }
}
 
Example 20
Source File: BigMatrixImpl.java    From astor with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns the entry in the specified row and column.
 * <p>
 * Row and column indices start at 0 and must satisfy
 * <ul>
 * <li><code>0 <= row < rowDimension</code></li>
 * <li><code> 0 <= column < columnDimension</code></li>
 * </ul>
 * otherwise a <code>MatrixIndexException</code> is thrown.</p>
 *
 * @param row  row location of entry to be fetched
 * @param column  column location of entry to be fetched
 * @return matrix entry in row,column
 * @throws MatrixIndexException if the row or column index is not valid
 */
public BigDecimal getEntry(int row, int column)
throws MatrixIndexException {
    try {
        return data[row][column];
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new MatrixIndexException(
                LocalizedFormats.NO_SUCH_MATRIX_ENTRY,
                row, column, getRowDimension(), getColumnDimension());
    }
}