Use permute pkg

Closes most of the issues (but not all) raised in #31: this issue discusses details and remaining issues. There really are some remaining issues, but the branch was growing too big: it is now 20 commits long and changes 33 files.
That approach was probably sensible; as you say, this is now a major PR!

Instead, how about we merge this PR once you change to `getPermuteMatrix()` (as below) and then we start again with adding tests etc. I worry that we'll get side tracked with other things and not get round to robustifying the code in later versions.