Path: news.mathworks.com!not-for-mail
From: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: a.*a ~= a*a'
Date: Fri, 3 Apr 2009 15:30:17 +0000 (UTC)
Organization: Ricardo UK Ltd
Lines: 17
Message-ID: <gr5a29$60s$1@fred.mathworks.com>
References: <gr15tq$f9b$1@fred.mathworks.com> <gr2m4p$c5b$1@fred.mathworks.com> <gr4c3m$6pt$1@fred.mathworks.com> <gr59km$7it$1@fred.mathworks.com>
Reply-To: "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com>
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 1238772617 6172 172.30.248.35 (3 Apr 2009 15:30:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 3 Apr 2009 15:30:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 43398
Xref: news.mathworks.com comp.soft-sys.matlab:530080

"James Tursa" <aclassyguywithaknotac@hotmail.com> wrote in message <gr59km$7it$1@fred.mathworks.com>...
> "Steve Amphlett" <Firstname.Lastname@Where-I-Work.com> wrote in message <gr4c3m$6pt$1@fred.mathworks.com>...
> > "James Tursa" <aclassyguywithaknotac@hotmail.com> wrote in message 
> > 
> > > For the sum(p * p') formulation (you don't need the sum() function here, btw), the p' is formed as a simple reshape of p with no data copying. You can see this as follows:
> > > 
> > > format debug
> > > a = rand(1,5)
> > > b = a'
> > > 
> > > You can see that the pr of both variables is the same.
> > 
> > For a 1D column/row vector, yes.  But not in a 2D array surely.
> 
> Yes, a 2D array transpose would require a data copy, of course. But that was not the problem OP posted.

Transposing a 2D array in a MEX is a real PITA.  Simple to do; simple to get wrong.  Always wrong the first time.