A colleague of mine recently lent a hand implementing a polynomial approximation routine I could port to our compiler, though it wasn’t the method I was expecting.
As I had written about previously, I was studying the Remez algorithm and implementing a prototype in Python. Remez approximation involves an iterated loop that alternates between root-finding and linear-system solving, and as such it can be rather brittle and difficult. Numerical errors and accuracy limits in these subsolvers contribute to weird edge cases that make the algorithm fail to converge. This was my experience implementing it using numpy/scipy for the solvers.
I had come to believe (erroneously, I now think) that there was a way to avoid the solvers by using something called the barycentric Remez algorithm. But when my colleague looked into it, he found the advice of the very same Nick Trefethen who wrote all the Remez explainers was instead to use a different method called the Caratheodory-Fejer method (CF below).
This method, which was reinvented a few times over the years and published in 1982 by Trefethen and Gutknecht, uses just two invocations of a numerical routine, one FFT to compute an initial Chebyshev approximation, and one eigenvalue solver for the meat of the CF method. In Trefethen’s words, CF is so close to the optimal Remez solution that for all practical purposes it’s good enough.
I saw the results of my colleague’s prototype and now I agree, so I’m in the process of porting it to C++ and integrating it into our HEIR compiler. That said, this 1988 paper studies when the CF method doesn’t do well, though I admit I understand none of the details. The authors construct what seems to be a very complicated counterexample, and prove a general theorem like “most arbitrary analytic functions aren’t well approximated with CF.”
I would like to better understand why CF works, and I haven’t enjoyed the 1982-and-earlier papers on the topic. The original Caratheodory-Fejer paper is from 1912 in German, the theorem is stated as Theorem 2.1 in this pdf. If anyone knows of a reference with an approachable proof, please let me know.
Want to respond? Send me an email, post a webmention, or find me elsewhere on the internet.
This article is syndicated on: