Changed the way the code generates matrices, so that it uses a memmapped file instead