Move calculation of fill-reducing permutation to lmm function.