MatrixView extends AbstractMatrix { @Override public double getQuick(int row, int column) { return matrix.getQuick(offset[ROW] + row, offset[COL] + column); } private  MatrixView();  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 getColumn(int column); @Override Vector getRow(int row);  }
@Test public void testGetQuick() { int[] c = test.size(); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', values[row + 1][col + 1], test.getQuick(row, col), EPSILON); } } }
@Test public void testAssignDouble() { int[] c = test.size(); test.assign(4.53); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', 4.53, test.getQuick( row, col), EPSILON); } } }
@Test public void testAssignDoubleArrayArray() { int[] c = test.size(); test.assign(new double[3][2]); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', 0.0, test.getQuick(row, col), EPSILON); } } }
@Test public void testAssignMatrixBinaryFunction() { int[] c = test.size(); test.assign(test, Functions.PLUS); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', 2 * values[row + 1][col + 1], test.getQuick(row, col), EPSILON); } } }
@Test public void testAssignUnaryFunction() { int[] c = test.size(); test.assign(Functions.NEGATE); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', -values[row + 1][col + 1], test.getQuick(row, col), EPSILON); } } }
@Test public void testDivide() { int[] c = test.size(); Matrix value = test.divide(4.53); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', values[row + 1][col + 1] / 4.53, value.getQuick(row, col), EPSILON); } } }
@Test public void testMinus() { int[] c = test.size(); Matrix value = test.minus(test); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', 0.0, value.getQuick(row, col), EPSILON); } } }
@Test public void testPlusDouble() { int[] c = test.size(); Matrix value = test.plus(4.53); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', values[row + 1][col + 1] + 4.53, value.getQuick(row, col), EPSILON); } } }
@Test public void testPlusMatrix() { int[] c = test.size(); Matrix value = test.plus(test); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', values[row + 1][col + 1] * 2, value.getQuick(row, col), EPSILON); } } }
@Test public void testTimesDouble() { int[] c = test.size(); Matrix value = test.times(4.53); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', values[row + 1][col + 1] * 4.53, value.getQuick(row, col), EPSILON); } } }
@Test public void testTranspose() { int[] c = test.size(); Matrix transpose = test.transpose(); int[] t = transpose.size(); assertEquals("rows", c[COL], t[ROW]); assertEquals("cols", c[ROW], t[COL]); for (int row = 0; row < c[ROW]; row++) { for (int col = 0; col < c[COL]; col++) { assertEquals("value[" + row + "][" + col + ']', test.getQuick(row, col), transpose.getQuick(col, row), EPSILON); } } }