@Test
public void readWriteDoubleNDim() throws Exception {

    MatFile input = MatTestUtil.readMat("arrays/multiDimMatrix.mat");
    compressedWriter.writeMat(input);
    buffer.flip();
    MatFile output = Mat5.newReader(Sources.wrap(buffer)).readMat();
    Matrix expected = input.getArray("in");
    Matrix actual = output.getArray("in");
    Assert.assertEquals(expected.getType(), actual.getType());
    Assert.assertArrayEquals(expected.getDimensions(), actual.getDimensions());
    // Access sequentially using raw store
    int numElements = expected.getNumElements();
    for (int i = 0; i < numElements; i++) {
        Assert.assertEquals(expected.getDouble(i), actual.getDouble(i), 0);
    }
}