Faster computation of total rank when creating differential layers.