Take advantage of separable basis functions #1530
Labels
performance
New feature or request to make the code faster
transforms
Related to the spectral-real space transformations
Right now, anytime we compute a series expansion, for all of the basis classes in DESC, the resulting Vandermonde matrix is computed by first forming an outer product of the mode numbers then evaluating the basis functions.
For each point$x$ , this generates a large mode matrix $A(x)$ of size $L M N$ . If there are $P$ points then the matrix $A$ has size $P L M N$ . From this matrix all the basis functions $f \colon A \mapsto f(A)$ are evaluated. In the performance analysis for this type of stuff, the dominant expense is by far evaluating $f$ . Hence, this is an inefficient approach to computing the Vandermonde matrix because $f$ must be evaluated at $P L M N$ times.
Now, because the basis function associated with any given spectral coefficient$a_{l,m,n}$ are separable in the spatial dimensions, more efficient methods can be used to generate the Vandermonde matrix. In particular for any basis the $K$ dimensional Vandermonde matrix should be computed by
This reduces the computational cost from$\mathcal{O}(P L M N)$ to $\mathcal{O}(P [L + M + N])$ and can be done without making any assumptions on the grid or computing auxiliary data. I have already updated the
DoubleFourierSeries
basis in #1440 with this change and it should be simple to extend it to the other basis.This can be done in complement to the partial summation techniques discussed in #1154 and #1243 .
The text was updated successfully, but these errors were encountered: