more efficient pre-computation of possible stage matrices