Search code examples
c++boostgslpolynomials

Boost alternative to gsl_sf_legendre_sphPlm_array() for Legendre polynomials


My understanding is that Boost library is much faster than GSL. I'm now maintaining a code that calls gsl_sf_legendre_sphPlm_array at some point in the calculation to compute Legendre polynomials. I was wondering: is there a Boost alternative to this function that performs sensibly better than the original GSL one?


Solution

  • The Legendre functions are simple, especially since they are implemented by a 3-term recurrence. Therefore, I do not expect boost to be any faster or slower than the GSL, especially for the evaluation of a Legendre series (say, using the boost legendre_next); they both should compile down to roughly the same assembly.

    The reason to use boost or the GSL depends almost entirely on your environment.

    One advantage of Boost is that it can be used in arbitrary precision; the cost is that you have to compile templates.