persistable sclass BlockOptimizedIntMatrix extends AbstractMatrix { // Each block is square with side length being a power of two // (i.e. blockSize = 1 << blockBits) int blockBits, blockSize; int bw, bh; // number of block cols/block rows int[] simpleBlocks; int[][] fullBlocks; *(int *w, int *h, int *blockBits) { blockSize = 1 << blockBits; bw = rshift_ceil(w, blockSize); bh = rshift_ceil(h, blockSize); } public A get(int x, int y) { ret data[y*w+x]; } public void set(int x, int y, A a) { data[y*w+x] = a; } }