bug-gsl
[Top][All Lists]
Advanced

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

[Bug-gsl] gsl_sf_bessel_Jn_e performance


From: Jonny Taylor
Subject: [Bug-gsl] gsl_sf_bessel_Jn_e performance
Date: Wed, 11 Jun 2008 12:31:39 +0100

Hi All,

I don't know what the policy is regarding optimizations which (slightly) decrease code readability, but there's a simple change to the downward recurrence in gsl_sf_bessel_Jn_e which doubles the speed of the function (almost all the remaining time is spent in gsl_sf_bessel_J_CF1) for n of order 10-40.

The modified code is listed below.

Cheers
Jonny

      double twoInvX = 2.0 / x;
      double kf;
      for(k=n, kf=n; k>0; k--, kf--) {
        Jkm1 = kf*twoInvX * Jk - Jkp1;
        Jkp1 = Jk;
        Jk   = Jkm1;
      }



reply via email to

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