How would I go about finding all possible permutations of a 4x4 matrix with static corner elements?
Just pull the placed numbers out of the permutation set. Then insert them into their proper position in the generated permutations.
For your example you'd take out 1, 16, 4, 13. Permute on (2, 3, 5, 6, 7,  8, 9, 10, 11, 12, 14, 15), for each permutation, insert 1, 16, 4, 13 where you have pre-selected to place them.
So far I have been using python to generate permutations of matrices for finding magic squares.  So what I have been doing so far (for 3x3 matrices) is that I find all the possible permutations of the set {1,2,3,4,5,6,7,8,9} using itertools.permutations, store them as a list and do my calculations and print my results.
Now I want to find out magic squares of order 4.  Since finding all permutations means 16! possibilities, I want to increase efficiency by placing likely elements in the corner, for example 1, 16 on diagonal one corners and 4, 13 on diagonal two corners.
So how would I find permutations of set {1,2....16} where some elements are not moved is my question