MatrixView extends AbstractMatrix { @Override public Vector viewRow(int row) { if (row < 0 || row >= rowSize()) { throw new IndexException(row, rowSize()); } return new VectorView(matrix.viewRow(row + offset[ROW]), offset[COL], columnSize()); } MatrixView(Matrix matrix, int[] offset, int[] size); @Override Matrix clone(); @Override double getQuick(int row, int column); @Override Matrix like(); @Override Matrix like(int rows, int columns); @Override void setQuick(int row, int column, double value); @Override int[] getNumNondefaultElements(); @Override Matrix viewPart(int[] offset, int[] size); @Override Matrix assignColumn(int column, Vector other); @Override Matrix assignRow(int row, Vector other); @Override Vector viewColumn(int column); @Override Vector viewRow(int row);  }
@Test public void testViewRow() { Vector row = test.viewRow(1); assertEquals("row size", 2, row.getNumNondefaultElements()); }
@Test(expected = IndexException.class) public void testViewRowIndexUnder() { test.viewRow(-1); }
@Test(expected = IndexException.class) public void testViewRowIndexOver() { test.viewRow(5); }