Create a list of permuation matrices in Octave / Matlab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% function to generate permutation matrices given the size of the desired permutation matrices | |
function x = permMatrices(n) | |
x = zeros(n,n,factorial(n)); | |
permutations = perms(1:n); | |
for i = 1:size(x,3) | |
x(:,:,i) = eye(n)(permutations(i,:),:); | |
end | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment