Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!b14g2000yqd.googlegroups.com!not-for-mail
From: arun <aragorn168b@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Efficient computation: differences of column vectors of matrix
Date: Tue, 30 Jun 2009 17:17:35 -0700 (PDT)
Organization: http://groups.google.com
Lines: 23
Message-ID: <cd6f7a80-0651-417d-ac72-88d6b326e1fe@b14g2000yqd.googlegroups.com>
NNTP-Posting-Host: 134.2.242.139
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Trace: posting.google.com 1246407455 17037 127.0.0.1 (1 Jul 2009 00:17:35 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 1 Jul 2009 00:17:35 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: b14g2000yqd.googlegroups.com; posting-host=134.2.242.139; 
	posting-account=fyqXpgoAAABqt-0BifyaNxmZhzggFACu
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.8) 
	Gecko/2009033100 Ubuntu/9.04 (jaunty) Firefox/3.0.8,gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:551873


Hi and thanks for the help,

I have a matrix say

A = [a1,b1,c1,d1; a2,b2,c2,d2; a3,b3,c3,d3; a4,b4,c4,d4]

now, I want the differences across the columns as,

B = [(a1-a2),(a1-a3),(a1-a4),(a2-a3),(a2-a4),(a3-a4);
       (b1-b2),(b1-b3),(b1-b4),(b2-b3),(b2-b4),(b3-b4);
       (c1-c2),(c1-c3),(c1-c4),(c2-c3),(c2-c4),(c3-c4);
       (d1-d2),(d1-d3),(d1-d4),(d2-d3),(d2-d4),(d3-d4)]

i would like to do this efficiently in Matlab because, my A =
200*250000 and so, after doing for each of the 200 columns... B matrix
would be 200*199/2= 19,900 * 250000. I would like to know if it could
be done efficiently (since its across columns). if space is a problem,
i can subdivide the matrix, it shouldn't be an issue.


thanks again,
regards,
arun.