### Question:
Outer2View extends AbstractMatrix implements Matrix { @Override public void set(int row, int col, double val) throws MatricksException { throw new RuntimeException("read-only"); } Outer2View(FlexFloatArray backing, int [] rowIndices, int [] columnIndices, double scale, boolean zeroDiag); static Outer2View fromColumn(Matrix backingMatrix, int backingColumn,int [] rowIndices, int [] columnIndices, double scale, boolean zeroDiag); @Override int numRows(); @Override int numCols(); @Override double get(int row, int col); @Override void set(int row, int col, double val); @Override MatrixCursor cursor(); @Override void mult(double[] x, double[] y);  }### Answer:
@Test public void test() throws Exception{ FlexFloatColMatrix m = new FlexFloatColMatrix(4, 5); m.set(1, 0, 1); m.set(3, 0, 1); OuterProductFlexFloatSymMatrix m2 = new OuterProductFlexFloatSymMatrix(4, m.getColumn(0), 1, false); double sum = m2.elementSum(); assertEquals(4d, sum, 0d); int [] rowIndices = {0,1,2}; int [] colIndices = {0,1}; Outer2View m3 = new Outer2View(m.getColumn(0), rowIndices, colIndices, 1d, false); sum = m3.elementSum(); assertEquals(1d, sum, 0d); m3 = new Outer2View(m.getColumn(0), rowIndices, colIndices, 0.5d, false); sum = m3.elementSum(); assertEquals(0.5d, sum, 0d); try { m3 = new Outer2View(m.getColumn(0), rowIndices, colIndices, 0.5d, true); fail("wasn't expecting to get here, maybe you wanna finish this test?"); } catch (RuntimeException e) { } }