### Question:
OuterProductSymMatrixFromMatrixColView extends AbstractMatrix implements
        SymMatrix { @Override public void set(int row, int col, double val) throws MatricksException { throw new MatricksException("read only view"); } OuterProductSymMatrixFromMatrixColView(Matrix backing, int backingCol, 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 multAdd(double alpha, double[] x, double[] y); @Override void mult(double[] x, double[] y); @Override SymMatrix subMatrix(int[] rowcols); @Override void setDiag(double alpha); @Override void addOuterProd(double[] x); @Override double sumDotMultOuterProd(double[] x); Matrix getMatrixView(int [] rowIndices, int [] colIndices);  }### Answer:
@Test public void testElementSum() { FlexFloatMatrix a = new FlexFloatMatrix(4, 6); a.set(0, 1, 1); a.set(0, 2, 1); a.set(0, 5, 1); a.set(1, 1, 1); a.set(1, 2, 1); a.set(1, 3, 1); a.set(2, 1, 1); a.set(2, 2, 1); a.set(2, 4, 1); a.set(2, 5, 1); a.set(3, 0, 1); a.set(3, 2, 1); a.set(3, 3, 1); a.set(3, 4, 1); int [] viewIndices = new int[4]; for (int i=0; i<viewIndices.length; i++) { viewIndices[i] = i; } OuterProductSymMatrixFromMatrixColView m = new OuterProductSymMatrixFromMatrixColView(a, 1, 1, false); SymMatrixView view = new SymMatrixView(m, viewIndices); double sum = view.elementSum(); assertEquals(9d, sum, 0d); m = new OuterProductSymMatrixFromMatrixColView(a, 1, 1, true); view = new SymMatrixView(m, viewIndices); sum = view.elementSum(); assertEquals(6d, sum, 0d); m = new OuterProductSymMatrixFromMatrixColView(a, 1, 0.5, true); view = new SymMatrixView(m, viewIndices); sum = view.elementSum(); assertEquals(3d, sum, 0d); }