Gave up on optimizing the 1D matrix because the critical section got to be stupid. Now generates it's own matrix