List of usage examples for org.apache.commons.math3.linear RealMatrix copySubMatrix
void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination) throws OutOfRangeException, NullArgumentException, NoDataException, MatrixDimensionMismatchException;
From source file:lirmm.inria.fr.math.BigSparseRealMatrixTest.java
private void checkCopy(RealMatrix m, double[][] reference, int[] selectedRows, int[] selectedColumns, boolean mustFail) { try {//from ww w.j a v a 2 s. co m double[][] sub = (reference == null) ? new double[1][1] : createIdenticalCopy(reference); m.copySubMatrix(selectedRows, selectedColumns, sub); Assert.assertEquals(new BigSparseRealMatrix(reference), new BigSparseRealMatrix(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; } } catch (MatrixDimensionMismatchException e) { if (!mustFail) { throw e; } } }