Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Avoiding loops in a symmetric matrix.
Date: Fri, 5 Dec 2008 20:28:03 +0000 (UTC)
Organization: Xoran Technologies
Lines: 20
Message-ID: <ghc2sj$djn$1@fred.mathworks.com>
References: <ghbdre$ahh$1@fred.mathworks.com> <ghc0n6$a98$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228508883 13943 172.30.248.35 (5 Dec 2008 20:28:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Dec 2008 20:28:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:505279

> You can send me your code, where you avoid the j-loop?
> 
> I do not need the diagonal.

OK. Here's what I have. However, it produces an array DeltaUnsorted whose columns may not be in the order you want. That part, I leave to you...

u=rand(100,200); 
nn=size(u,2); 
Z=cell(1,nn-1);

tic; 
 for ii=1:nn-1, 
  Z{ii}=u-circshift(u,[0,-ii]);
 end, 
DeltaUnsorted=[Z{:}]; 
toc

Elapsed time is 0.165232 seconds.