help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Computing distance matrix robustly


From: Tom Holroyd
Subject: Re: Computing distance matrix robustly
Date: Sun, 2 Oct 2005 18:50:35 -0400 (EDT)

On Sun, 2 Oct 2005, [utf-8] S?ren Hauberg wrote:
Sorry about replying to my own post, but Tom Holroyd, contacted me
off-list with a solution. Simply replace
sX2 = sum(X.^2, 2);
with
sX2 = sumsq(X, 2);
in the vectorized version, and then things work.

I'm actually surprised that it worked. But perhaps (in addition to being faster) it is true that the FPU's registers are actually wider than a double? In that case, since X.^2 has to make a temp array, it forces a loss of precision. I wouldn't expect 1e-7 of roundoff anyway, though. Unless the arrays in question are floats?

Dr. Tom Holroyd
"A man of genius makes no mistakes. His errors are volitional and
are the portals of discovery." -- James Joyce



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]