Skip to content

Instantly share code, notes, and snippets.

Created December 14, 2015 08:29
What would you like to do?
Create a list of permuation matrices in Octave / Matlab
% 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,:),:);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment