From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to reduce the combinations' dimension--speed up my cross product
Date: Tue, 12 Jul 2011 07:29:09 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 24
Message-ID: <ivgt45$9jv$>
References: <ivevlp$kdi$> <ivf2lq$sq$> <ivf45m$5qf$> <ivfh09$gkk$> <ivgrqs$6om$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1310455749 9855 (12 Jul 2011 07:29:09 GMT)
NNTP-Posting-Date: Tue, 12 Jul 2011 07:29:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:735910

"Skirt Zhang" <> wrote in message <ivgrqs$6om$>...
> Hi Roger,
> Thanks a lot for your kind help.
> So I will use this randperm to generate my index sequence and then according to this index I need to calculate the product of any three values. 
> Is there a clever way to address this issue?
> BIG thanks

I strongly recommend to take a look a SHUFFLE by Jan Simon:

It's very efficient when the drawing population length (3) is much smaller than the total population (n):

n = length(b);
m = 1000;
a = zeros(1,m);
for k=1:m
    a(k) = prod(b(Shuffle(n,'index',3)));

% Bruno