The Legendre.jl package accumulates the features shown throughout this series (and more) into a package expressly designed for calculating numerically accurate Legendre polynomials in a performant manner. In this article I formally introduce the package and demonstrate how it can be used to quickly prototype a couple of useful computations that I have encountered in CMB analysis.
An algorithm for calculating special functions is no use if it has poor numerical accuracy and returns inaccurate or invalid answers. In this article I discuss the importance of using fused multiply-add (FMA) and a form of loop-unrolling to maintain numerical accuracy in calculating the associated Legendre polynomials to degrees and orders of order 1000 and greater.
In the previous part we computed Legendre polynomials via a few recurrence relations, but the polynomial values grow rapidly with degree and quickly overflow the range of standard finite floating point numbers. In this posting we explore baking in a normalization factor into the recurrence relation — such as used when the Legendre polynomials are used to calculate the spherical harmonics — that eliminates the overflow.
The Associated Legendre Polynomials are implicitly defined as the solution to a second-order differential equation, but most practical uses require an efficient means of explicitly evaluating the functions for any degree, order, and argument. In this article I introduce the implementation used in Legendre.jl which is based on evaluating a series of recurrence relations.
The Associated Legendre Polynomials are an important set of functions in cosmic microwave background (CMB) research. In this first part of an upcoming series, I motivate the need for a new high-performance Julia package — Legendre.jl — which I am writing to recreate a key algorithm in my thesis research.