@Test
public void testSetData() throws IOException {

  File f = File.createTempFile("matrix", ".m", getTestTempDir());
  f.deleteOnExit();
  Matrix m0 = new DenseMatrix(100000, 30);
  MultiNormal gen = new MultiNormal(30);
  for (MatrixSlice row : m0) {
    row.vector().assign(gen.sample());
  }
  FileBasedMatrix.writeMatrix(f, m0);
  FileBasedMatrix m = new FileBasedMatrix(100000, 30);
  m.setData(f, true);
  assertEquals(0, m0.minus(m).aggregate(Functions.MAX, Functions.ABS), 1.0e-8);
  int i = 0;
  for (MatrixSlice row : m) {
    assertEquals(0, row.vector().minus(m0.viewRow(i++)).norm(1), 1.0e-8);
  }
}