Chebyshev approximations are a way of representing any bound, continuous function, with a polynomial. Having a polynomial representation means that further function manipulations, such as derivation, integration, and root-finding, become relatively trivial computations.

The first step for this project, as a proof of concept, was to write it in vanilla haskell, using lists as the primary representation of Chebyshev Polynomials. The introduction of the project can be found in an earlier post here.

One of the Haskell libraries that have been developed is Accelerate, an embedded language that allows for parallel array computations on computers with more than one core.

Since the Chebyshev polynomials in this project are, in fact, represented by arrays or lists of coefficients, I wanted to make full use of the parallel computing capabilities of the language. I spent the past few weeks converting my code to the Accelerate language.

The primary function of accelerate is to automatically generate optimized code. There are two primary types of values in Accelerate: Scalars and Arrays.

Using accelerate required a different way of thinking. I had to write functions that allow everything to be computed all at once. As an example, The chebyshev approximation is, by definition, \(f\left( x \right) \cong \ \sum_{i = 0}^{\infty}{c_{i}T_{i}(x)}\ \).

The list approach

I could simply generate the list of coefficients, generate the list of polynomials (as a list of lists), and map the coefficient with the respective polynomial. The last step is simply to sum up all the polynomials.