I have a very large matrix A with N rows and M columns. I want to basically do the following operation
for k = 1:N
A(k,:) = A(k,randperm(M));
end
but fast and efficiently. (Both M and N are very large, and this is only an inner loop in a more massive outer loop.)
More context: I am trying to implement a permutation test for a correlation matrix (http://en.wikipedia.org/wiki/Resampling_%28statistics%29). My data is very large and I am very impatient. If anyone knows of a fast way to implement such a test, I would also be grateful to hear your input!
Do I have any hope of avoiding doing this in a loop?
Apologies if this has already been asked. Thanks!