Path: news.mathworks.com!not-for-mail
From: "John D'Errico" <woodchips@rochester.rr.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Speeding up sum of squares
Date: Thu, 8 May 2008 01:40:03 +0000 (UTC)
Organization: John D'Errico (1-3LEW5R)
Lines: 18
Message-ID: <fvtllj$n9b$1@fred.mathworks.com>
References: <fm012450tjat7jgv5hqhtiokid3ketdsgj@4ax.com> <fvq0qr$7tv$1@fred.mathworks.com> <1v2124dbkuukhhprui7a8ss4vhmtgn3jcg@4ax.com> <fvq421$p13$1@fred.mathworks.com> <fvtkg4$foh$1@fred.mathworks.com>
Reply-To: "John D'Errico" <woodchips@rochester.rr.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210210803 23851 172.30.248.37 (8 May 2008 01:40:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 8 May 2008 01:40:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869215
Xref: news.mathworks.com comp.soft-sys.matlab:467280


"Tim Davis" <davis@cise.ufl.edu> wrote in message 
<fvtkg4$foh$1@fred.mathworks.com>...

> I'd hazard a guess that it's not a BLAS performance
> difference.  There really isn't a lot of benefit in
> performance of the level-1 BLAS as compared with plain code,
> given modern optimizing compilers.
> 
> It's probably because MATLAB is computing z=x.^2, and
> storing z as a new vector, internally.  Then it sums it up.
>  The creation of y takes more memory traffic (8*n bytes
> written then read back in).  I would be quite surprised that
> MATLAB is smart enough not to form the vector z,
> but when it does x'*x it knows not to do that.

Of course. This makes much sense.

John