check_permute function

Check that permute is a logical