Added permutation matrix conversion routines