Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Developing most optimal DotProduct function



Thank you, Ian and Holger, for your explanations and suggestions. I checked dotprD - it gives closer results.
I didnt suspected what dot product function could be that sensitive to the order of calculations.


--
Sincerely,
	Rustam Muginov

On Nov 7, 2005, at 9:17 PM, Ian Ollmann wrote:

Sometimes the relative error is rather high, like 11% or so.

That does sound like way too much.

This can happen when accumulating mixtures of positive and negative numbers. Certain subtractions of very similar numbers may cause a loss of nearly all your precision. (The precision was technically lost in earlier roundings.) All and all, I'd say it's probably more efficient to use double precision accumulators than it is to spend time sorting inputs, however. The precision (and range!) of the product is completely covered by a double and more of the additions will be infinitely precise.


Note that double precision can still suffer from the same sorts of catastrophic cancellation problems. However, it tends to happen much less often. There do remain cases, particularly with complex arithmetic, where this sort of problem can happen frequently.


You should probably use a double precision dot product as your reference for correctness.


Ian


_______________________________________________ Do not post admin requests to the list. They will be ignored. PerfOptimization-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >Developing most optimal DotProduct function (From: Rustam Muginov <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Holger Bettag <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Rustam Muginov <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Holger Bettag <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Ian Ollmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.