### Question:
DenseMatrix implements Matrix<DenseMatrixRow> { @Override public Iterator<DenseMatrixRow> iterator() { return new DenseMatrixIterator(); } DenseMatrix(File path); @Override DenseMatrixRow getRow(int rowId); @Override int[] getRowIds(); int[] getColIds(); @Override int getNumRows(); ValueConf getValueConf(); @Override Iterator<DenseMatrixRow> iterator(); @Override File getPath(); @Override void close(); static final Logger LOG; static final int FILE_HEADER; static final int DEFAULT_HEADER_SIZE; }### Answer:
@Test public void testWrite() throws IOException { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); }
@Test public void testReadWrite() throws IOException { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); DenseMatrix m1 = new DenseMatrix(tmp); DenseMatrix m2 = new DenseMatrix(tmp); }
@Test public void testTranspose() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp1 = File.createTempFile("matrix", null); File tmp2 = File.createTempFile("matrix", null); File tmp3 = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp1, srcRows.iterator()); DenseMatrix m = new DenseMatrix(tmp1); verifyIsSourceMatrix(m); } }
@Test public void testRows() throws IOException { for (int numOpenPages: new int[] { 1, Integer.MAX_VALUE}) { File tmp = File.createTempFile("matrix", null); DenseMatrixWriter.write(tmp, srcRows.iterator()); DenseMatrix m = new DenseMatrix(tmp); verifyIsSourceMatrix(m); } }