Abstract
This paper presents a novel algorithm for computing the Discrete Legendre Transform (DLT) and its inverse with a computational complexity of $\mathcal{O}(N(\log N)^2/\log\log N)$. The approach bridges the gap between Legendre expansions and the Fast Fourier Transform (FFT) by decomposing the transform into a coefficient conversion step followed by a non-uniform Discrete Cosine Transform (NDCT). By treating Legendre nodes as small perturbations of an equally-spaced Chebyshev grid, the authors utilize a truncated Taylor series expansion to achieve machine precision with minimal computational overhead.
Introduction: The Legendre-Chebyshev Gap
In computational science and numerical analysis, Legendre polynomials are frequently preferred for their orthogonality in the $L^2$-norm, which aligns with the physical energy norms of many differential equations. However, they have historically lacked the computational efficiency of Chebyshev polynomials, which benefit from the $\mathcal{O}(N \log N)$ Fast Fourier Transform (FFT).
The Discrete Legendre Transform (DLT)—the evaluation of a degree $N-1$ Legendre expansion at $N$ Legendre nodes—traditionally requires $\mathcal{O}(N^2)$ operations. While previous "fast" DLTs existed, they often involved complex parameter tuning or significant precomputation. This work introduces a robust, FFT-based DLT that is simple to implement and requires no manual tuning.
Methodology: A Two-Stage Transform
The proposed algorithm avoids the direct $\mathcal{O}(N^2)$ summation by decomposing the DLT into two primary stages, as illustrated in the workflow below:
- Coefficient Conversion: The algorithm first converts Legendre coefficients into Chebyshev coefficients. This step utilizes an existing fast transform based on asymptotic expansions of Legendre polynomials, running in $\mathcal{O}(N(\log N)^2/\log \log N)$.
- Non-uniform Discrete Cosine Transform (NDCT): Once in the Chebyshev domain, the expansion must be evaluated at Legendre nodes. Because these nodes are not perfectly equally spaced in the frequency domain, a standard FFT cannot be applied directly. The authors solve this by treating Legendre nodes as perturbations of a Chebyshev grid.
Key Insight: The Perturbation Perspective
The core innovation lies in the observation that Legendre nodes $\theta_j^{leg}$ are remarkably close to the equally-spaced Chebyshev nodes $\theta_j^{cheb}$. Specifically, the distance between them scales as $\mathcal{O}(1/N)$.
By applying a truncated Taylor series expansion of the Chebyshev polynomials around the equally-spaced points, the non-uniform transform is reduced to a small sum of standard Discrete Cosine and Sine Transforms (DCTs and DSTs). Because the perturbation is so small, only a few terms (typically $L < 20$) are required to reach double-precision accuracy ($10^{-16}$). This approach leverages the highly optimized FFT ecosystem (like FFTW) without the need for complex "butterfly" algorithms or oversampled Non-uniform FFTs (NFFTs).
Results and Performance
The algorithm achieves its theoretical complexity of $\mathcal{O}(N(\log N)^2/\log \log N)$ and demonstrates significant practical speedups:
- Crossover Points: The fast forward DLT becomes more efficient than the direct $\mathcal{O}(N^2)$ method at approximately $N = 5,000$. The NDCT component alone crosses over even earlier, around $N = 1,000$.
- Numerical Stability: The method maintains machine precision across a wide range of $N$. For smooth functions where coefficients decay, the error growth is negligible, often outperforming direct recurrence-based methods for very large $N$.
- Zero Precomputation: Unlike many fast algorithms that require storing large matrices, this method relies on analytic expansions, making it ideal for adaptive simulations where the grid size $N$ changes dynamically.
Conclusion
By combining asymptotic coefficient conversion with a Taylor-based NDCT, the authors have provided a practical and efficient tool for Legendre-based spectral methods. The algorithm's reliance on standard FFT building blocks ensures ease of implementation and high performance on modern hardware, making Legendre expansions a viable alternative to Chebyshev methods in large-scale computational tasks.
Summary updated