alphalinux.org high-perf list (1998-2001)
 help / color / mirror / Atom feed
From: esci <esci@fastlane.net>
Subject: Re: sqrt performance
Date: Wed, 3 Mar 1999 14:53:39 -0600 (CST)	[thread overview]
Message-ID: <199903032053.OAA0000010875@localhost> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]

[snip]

>Looking at the structure of your code I think it *should* be possible

>to get some acceleration exploiting regulatiry of sqrt argument:

>some_value*constant_for_this_cycle+delta^2*(i++)^2

>for i=1,N

>

>I'm thinking about division of one argument over other.

>Can you expect any relation of general nature like

>some_value*constant_for_this_cycle<<delta^2*(i++)^2

>or vice versa or anything in this style ?

All the values are monotonic, so you can speed things up a good bit by using

the previous result as the starting point in a Newtonian iteration. It gives

a factor of 3 speed up w/ g77 or NDP, but is slightly slower than the DU

library routine.  This was with 2 steps hard coded w/o conditional logic.

I only need 13 bits of accuracy as the result is an index into an array.

One of the things that is slowly sinking in is that my loop is too short,

typically under 100 iterations.  From what I'm seeing, I should be able to

get faster results by chaining a number of loops together.

BTW can anyone provide good references on sqrt() methods?  I looked in

Knuth and quite a few other math references but found little other than very

basic stuff (i.e. Newton's method)  Knuth has one algorithm posed as an

exercise (M40 == Mathematical, term project difficulty :-(

I'm currently looking into using a table driven Taylor's series expansion.

Hint's and suggestions *very* welcome.  I need to do this over the range

from 0 to 100,000,000  w/ the roots off by less than 1 (I actually need

integer roots for the indexing).  There ought to be a way to get this going 

a lot faster.

Reginald Beardsley

------------------------------------------------------------------------

              Exploration Software Consultants Inc.

Voice: 972-379-0557                      email: rhb@acm.org

Fax:   972-379-0558

------------------------------------------------------------------------

             reply	other threads:[~1999-03-03 20:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03 20:53 esci [this message]
1999-03-03 21:40 ` sqrt performance Andrei A. Dergatchev
1999-03-04  5:15 ` Michal Jaegermann
1999-03-04 18:30   ` Joachim Wesner
1999-03-04 18:48   ` sqrt performance, further comment Joachim Wesner
1999-03-04 19:41     ` Michal Jaegermann
1999-03-04 19:51       ` Joachim Wesner
1999-03-05 17:55   ` Joachim Wesner
  -- strict thread matches above, loose matches on Subject: below --
1999-03-03 13:21 sqrt performance esci
1999-03-03 18:51 ` Andrei A. Dergatchev
1999-03-03  2:26 esci
1999-03-03  9:27 ` Andrei A. Dergatchev
1999-03-03 11:59   ` Kazushige Goto
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox