Example usage for org.apache.commons.math3.linear RealMatrix getSubMatrix

List of usage examples for org.apache.commons.math3.linear RealMatrix getSubMatrix

Introduction

In this page you can find the example usage for org.apache.commons.math3.linear RealMatrix getSubMatrix.

Prototype

RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns)
        throws NullArgumentException, NoDataException, OutOfRangeException;

Source Link

Document

Gets a submatrix.

Usage

From source file:lirmm.inria.fr.math.BigSparseRealMatrixTest.java

private void checkGetSubMatrix(RealMatrix m, double[][] reference, int[] selectedRows, int[] selectedColumns,
        boolean mustFail) {
    try {//from  w  w  w  .j  ava2  s .co m
        RealMatrix sub = m.getSubMatrix(selectedRows, selectedColumns);
        Assert.assertEquals(new BigSparseRealMatrix(reference), sub);
        if (mustFail) {
            Assert.fail("Expecting OutOfRangeException or NumberIsTooSmallException or NoDataException");
        }
    } catch (OutOfRangeException e) {
        if (!mustFail) {
            throw e;
        }
    } catch (NumberIsTooSmallException e) {
        if (!mustFail) {
            throw e;
        }
    } catch (NoDataException e) {
        if (!mustFail) {
            throw e;
        }
    }
}