desired precision for Jinc approximation

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

desired precision for Jinc approximation

Post by NicolasRobidoux »

Anthony:

I'm going to break the approximation of Jinc in two pieces: |x|<=r3 (minimax approx. custom built by Chantal Racette and I), and |x|>r3, for which I'll use the standard (Hart's) method. (Here, r3 is the true zero of BesselJ1 before pi scaling, which is just a bit larger than 10.)

Do you really care about getting close to full double precision for Jinc evaluation?

For example, my preliminary results give max absolute error on [-r3,r3] less than 8e-09 (when the rational function is evaluated in double precision; in single precision, it's less than 9e-7 <- not of interest to IM anyway, but interesting to me because of SSE/Altivec/MMX/... and GPUs) at a cost of 23 flops (including one division, but excluding the squaring back of the square rooted distance, which adds one flop to the total).

I would guess that this is good enough.

Agreed?

(I can, of course, produce more precise approximations, but I think it's a waste of flops for IM.)
Last edited by NicolasRobidoux on 2010-12-19T15:00:39-07:00, edited 1 time in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: desired precision for Jinc approximation

Post by NicolasRobidoux »

A nice reference about floating point approximation of the Bessel functions http://www.systomath.com/include/Boost- ... essel.html.

See, also, http://www.netlib.org/specfun/j1y1.

(I'm not using this for the [-r3,r3] approximation: I'm using minimax software.)
Last edited by NicolasRobidoux on 2010-12-20T07:46:43-07:00, edited 2 times in total.
NicolasRobidoux
Posts: 1944
Joined: 2010-08-28T11:16:00-07:00
Authentication code: 8675308
Location: Montreal, Canada

Re: desired precision for Jinc approximation

Post by NicolasRobidoux »

Another question for Anthony:

Are you OK with me getting rid of BesselOrderOne and approximating Jinc directly. For example, right now, BesselOrderOne is computed from J1 (Jinc itself) for small x by multiplying J1 by x, and then Jinc is computed by redividing by x.

Is BesselOrderOne used for anything else? (We could recover it from Jinc anyway ;-)
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: desired precision for Jinc approximation

Post by anthony »

I don't think ultra high precision is needed.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply