From: Terry Murphy on
Folks,

I'm doing a simple calculation that has a little bit of variability associated with the ordering of the 35 terms, therefore I need to run the operation over all permutations to get the standard error of this calculation.

Problem is that 35! (the number of permutations) is greater than 10^40, and therefore infeasible from both storage and computational perspectives.

Is there any simple way that I could randomly sample a reasonably large number, say 300k, of the 10^40 possibilities from which I could then estimate my standard error?

TEM
From: Matt Fig on
This may be of some help:


http://www.mathworks.com/matlabcentral/fileexchange/24459-next-combinationpermutation
From: Matt Fig on
On second thought, the order of the permutations returned by that function is not random. I do have a random one somewhere around here. If nobody else helps you get to it, I will post it later.
From: Jos (10584) on
"Terry Murphy" <terrence.murphy(a)yale.edu> wrote in message <hgb9f0$8jt$1(a)fred.mathworks.com>...
> Folks,
>
> I'm doing a simple calculation that has a little bit of variability associated with the ordering of the 35 terms, therefore I need to run the operation over all permutations to get the standard error of this calculation.
>
> Problem is that 35! (the number of permutations) is greater than 10^40, and therefore infeasible from both storage and computational perspectives.
>
> Is there any simple way that I could randomly sample a reasonably large number, say 300k, of the 10^40 possibilities from which I could then estimate my standard error?
>
> TEM

easy enough!

K = 10 ;
N = 4 ;
[ignore, R] = sort(rand(K,N)) ;
% N random permutations of 1 to K
% Each column of R holds one random permutation
R

You might also take a look at SHAKE
http://www.mathworks.com/matlabcentral/fileexchange/10067-shake

R = shake(repmat(1:K,N,1).')

hth
Jos
From: Bruno Luong on
What about something like this:

m = 35;
n = 30e3;

I = rand(n,m);
[I I] = sort(I,2);
I = unique(I,'rows'); % likely nothing is rejected here

Bruno