FastTransforms
Loading...
Searching...
No Matches
FastTransforms

What FastTransforms actually computes.

\(\def\ud{{\rm\,d}} \def\ii{{\rm i}} \def\fl{{\rm\,fl}} \def\abs#1{\left|{#1}\right|} \def\norm#1{\left\|{#1}\right\|} \def\conj#1{\overline{#1}} \)

FastTransforms provides computational kernels and driver routines for multivariate orthogonal polynomial transforms. The algorithms are \(2\)-normwise backward stable with a runtime complexity of \(\mathcal{O}(n^{d+1})\), where \(n\) is the polynomial degree and \(d\) is the spatial dimension of the problem.

The transforms are separated into computational kernels that offer SSE, AVX, and AVX-512 vectorization on applicable Intel processors, and driver routines that are easily parallelized by OpenMP.

What FastTransforms actually computes

For every subsection below, the title of the subsection, of the form a2b, refers conceptually to the transform and the available functions are as follows:

  • ft_plan_a2b, is a pre-computation,
  • ft_execute_a2b, is a forward execution,
  • ft_execute_b2a, is a backward execution,
  • ft_execute_a_hi2lo, is a conversion to a tensor-product basis,
  • ft_execute_a_lo2hi, is a conversion from a tensor-product basis,
  • ft_kernel_a_hi2lo, is an orthonormal conversion from high to low order,
  • ft_kernel_a_lo2hi, is an orthonormal conversion from low to high order.

The ft_execute_* functions are drivers that perform transforms as defined below. They are composed of computational kernels, of the form ft_kernel_*, that are designed to be sufficiently generic to be assembled for different parallelism and compute paradigms. For good use of SIMD, the computational kernels rely on row-major ordering of the coefficients, and for trivial shared memory parallelism, the driver routines rely on column-major ordering of the coefficients. Local permutations are utilized to balance the use of SIMD and OpenMP multithreading. Generally, the pre-computations construct a ft_harmonic_plan, which may be destroyed by a call to ft_destroy_harmonic_plan. The arguments of all of these functions are explained in Function arguments.

sph2fourier

Real orthonormal spherical harmonics in \(L^2(\mathbb{S}^2)\) are:

\begin{align*}Y_\ell^m(\theta,\varphi) & = (-1)^{\abs{m}}\sqrt{(\ell+\tfrac{1}{2})\frac{(\ell-\abs{m})!}{(\ell+\abs{m})!}} P_\ell^{\abs{m}}(\cos\theta) \sqrt{\frac{2-\delta_{m,0}}{2\pi}} \left\{\begin{array}{ccc} \cos(m\varphi) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\varphi) & {\rm for} & m < 0,\end{array}\right. \end{align*}

where \(P_\ell^m(\cos\theta)\) are the associated Legendre functions. For \(0\le m\le\ell\), these may be defined by differentiating Legendre polynomials:

\[P_\ell^m(x) = (-1)^m (1-x^2)^{\frac{m}{2}} \dfrac{{\rm d}^m}{{\rm d} x^m} P_\ell(x), \]

and defined equivalently by ultraspherical polynomials:

\[P_\ell^m(\cos\theta) = (-2)^m(\tfrac{1}{2})_m \sin^m\theta C_{\ell-m}^{(m+\frac{1}{2})}(\cos\theta), \]

so that the spherical harmonics have positive real phase. A degree- \((n-1)\) expansion in spherical harmonics is given by:

\[f_{n-1}(\theta,\varphi) = \sum_{\ell=0}^{n-1}\sum_{m=-\ell}^{+\ell} f_\ell^m Y_\ell^m(\theta,\varphi). \]

If real spherical harmonic expansion coefficients are organized into the array:

\[F = \begin{pmatrix} f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2 & \cdots & f_{n-1}^{1-n} & f_{n-1}^{n-1}\\ f_1^0 & f_2^{-1} & f_2^1 & f_3^{-2} & f_3^2 & \cdots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ f_{n-3}^0 & f_{n-2}^{-1} & f_{n-2}^1 & f_{n-1}^{-2} & f_{n-1}^2 & & \vdots & \vdots\\ f_{n-2}^0 & f_{n-1}^{-1} & f_{n-1}^1 & 0 & 0 & \cdots & 0 & 0\\ f_{n-1}^0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\ \end{pmatrix}, \]

then ft_plan_sph2fourier creates the appropriate ft_harmonic_plan, and ft_execute_sph2fourier returns the bivariate Fourier coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^{-1} & g_0^1 & \cdots & g_0^{1-n} & g_0^{n-1}\\ g_1^0 & g_1^{-1} & g_1^1 & \cdots & g_1^{1-n} & g_1^{n-1}\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ g_{n-2}^0 & g_{n-2}^{-1} & g_{n-2}^1& \cdots & g_{n-2}^{1-n} & g_{n-2}^{n-1}\\ g_{n-1}^0 & 0 & 0 & \cdots & g_{n-1}^{1-n} & g_{n-1}^{n-1}\\ \end{pmatrix}. \]

That is:

\[f_n(\theta,\varphi) = \sum_{\ell=0}^{n-1}\sum_{m=1-n}^{n-1} g_\ell^m \left\{\begin{array}{ccc} \cos(\ell\theta) & {\rm for} & m~{\rm even},\\ \sin((\ell+1)\theta) & {\rm for} & m~{\rm odd},\end{array}\right\} \sqrt{\frac{2-\delta_{m,0}}{2\pi}}\left\{\begin{array}{ccc} \cos(m\varphi) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\varphi) & {\rm for} & m < 0,\end{array}\right. \]

and ft_execute_fourier2sph converts them back.

disk2cxf

Real orthonormal generalized Zernike polynomials in \(L^2(\mathbb{D}^2, r^{2\alpha+1}(1-r^2)^\beta\ud r\ud\theta)\) are:

\[Z_{\ell,m}^{(\alpha,\beta)}(r,\theta) = 2^{\frac{\abs{m}+\alpha+\beta+2}{2}} r^{\abs{m}}\tilde{P}_{\frac{\ell-\abs{m}}{2}}^{(\beta,\abs{m}+\alpha)}(2r^2-1) \sqrt{\frac{2-\delta_{m,0}}{2\pi}} \left\{\begin{array}{ccc} \cos(m\theta) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\theta) & {\rm for} & m < 0,\end{array}\right. \]

where the tilde implies that the univariate Jacobi polynomials are orthonormal. A degree- \((2n-2)\) expansion in generalized Zernike polynomials is given by:

\[f_{2n-2}(r,\theta) = \sum_{\ell=0}^{2n-2}\sum_{m=-\ell,2}^{+\ell} f_\ell^m Z_{\ell,m}^{(\alpha,\beta)}(r,\theta), \]

where the \(,2\) in the inner summation index implies that the inner summation runs from \(m=-\ell\) in steps of \(2\) up to \(+\ell\). If generalized Zernike expansion coefficients are organized into the array:

\[F = \begin{pmatrix} f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2 & \cdots & f_{2n-2}^{2-2n} & f_{2n-2}^{2n-2}\\ f_2^0 & f_3^{-1} & f_3^1 & f_4^{-2} & f_4^2 & \cdots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ f_{2n-6}^0 & f_{2n-5}^{-1} & f_{2n-5}^1 & f_{2n-4}^{-2} & f_{2n-4}^2 & & \vdots & \vdots\\ f_{2n-4}^0 & f_{2n-3}^{-1} & f_{2n-3}^1 & f_{2n-2}^{-2} & f_{2n-2}^2 & \cdots & 0 & 0\\ f_{2n-2}^0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\ \end{pmatrix}, \]

then ft_plan_disk2cxf creates the appropriate ft_harmonic_plan, and ft_execute_disk2cxf returns the even Chebyshev–Fourier coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^{-1} & g_0^1 & g_0^{-2} & g_0^2 & \cdots & g_0^{2-2n} & g_0^{2n-2}\\ g_2^0 & g_2^{-1} & g_2^1 & g_2^{-2} & g_2^2 & \cdots & g_2^{2-2n} & g_2^{2n-2}\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ g_{2n-4}^0 & g_{2n-4}^{-1} & g_{2n-4}^1 & g_{2n-4}^{-2} & g_{2n-4}^2 & \cdots & g_{2n-4}^{2-2n} & g_{2n-4}^{2n-2}\\ g_{2n-2}^0 & 0 & 0 & g_{2n-2}^{-2} & g_{2n-2}^2 & \cdots & g_{2n-2}^{2-2n} & g_{2n-2}^{2n-2}\\ \end{pmatrix}. \]

That is:

\[f_{2n-2}(r,\theta) = \sum_{\ell=0}^{n-1}\sum_{m=2-2n}^{2n-2} g_{2\ell}^m \left\{\begin{array}{ccc} T_{2\ell}(r) & {\rm for} & m~{\rm even},\\ T_{2\ell+1}(r) & {\rm for} & m~{\rm odd},\end{array}\right\} \sqrt{\frac{2-\delta_{m,0}}{2\pi}}\left\{\begin{array}{ccc} \cos(m\theta) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\theta) & {\rm for} & m < 0,\end{array}\right. \]

and ft_execute_cxf2disk converts them back.

ann2cxf

Consider \(P_n^{t,(\alpha,\beta,\gamma)}(x)\) to be orthogonal polynomials in \(L^2([-1,1], (1-x)^\alpha(1+x)^\beta(t+x)^\gamma\ud x)\), for parameter values \(\{t>1, \alpha,\beta>-1, \gamma\in\mathbb{R}\}\cup\{t=1, \alpha,\beta+\gamma>-1\}\).

Real orthonormal annulus polynomials in \(L^2(\{(r,\theta) : \rho < r < 1, 0 < \theta < 2\pi\}, r^{2\gamma+1}(r^2-\rho^2)^\alpha(1-r^2)^\beta\ud r\ud\theta)\) are:

\[Z_{\ell,m}^{\rho,(\alpha,\beta,\gamma)}(r,\theta) = \sqrt{2} \left(\frac{2}{1-\rho^2}\right)^{\frac{\abs{m}+\alpha+\beta+\gamma+1}{2}} r^{\abs{m}}\tilde{P}_{\frac{\ell-\abs{m}}{2}}^{\frac{1+\rho^2}{1-\rho^2},(\beta,\alpha,\abs{m}+\gamma)}\left(\frac{2r^2-1-\rho^2}{1-\rho^2}\right) \sqrt{\frac{2-\delta_{m,0}}{2\pi}} \left\{\begin{array}{ccc} \cos(m\theta) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\theta) & {\rm for} & m < 0,\end{array}\right. \]

where the tilde implies that \(\tilde{P}_n^{t,(\alpha,\beta,\gamma)}(x)\) are orthonormal. In the limit as \(\rho\to0\), the annulus polynomials converge to the Zernike polynomials, \(Z_{\ell,m}^{0,(\alpha,\beta,\gamma)}(r, \theta) = Z_{\ell,m}^{(\alpha+\gamma,\beta)}(r, \theta)\). A degree- \((2n-2)\) expansion in annulus polynomials is given by:

\[f_{2n-2}(r,\theta) = \sum_{\ell=0}^{2n-2}\sum_{m=-\ell,2}^{+\ell} f_\ell^m Z_{\ell,m}^{\rho,(\alpha,\beta,\gamma)}(r,\theta), \]

where the \(,2\) in the inner summation index implies that the inner summation runs from \(m=-\ell\) in steps of \(2\) up to \(+\ell\). If annulus polynomial expansion coefficients are organized into the array:

\[F = \begin{pmatrix} f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2 & \cdots & f_{2n-2}^{2-2n} & f_{2n-2}^{2n-2}\\ f_2^0 & f_3^{-1} & f_3^1 & f_4^{-2} & f_4^2 & \cdots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ f_{2n-6}^0 & f_{2n-5}^{-1} & f_{2n-5}^1 & f_{2n-4}^{-2} & f_{2n-4}^2 & & \vdots & \vdots\\ f_{2n-4}^0 & f_{2n-3}^{-1} & f_{2n-3}^1 & f_{2n-2}^{-2} & f_{2n-2}^2 & \cdots & 0 & 0\\ f_{2n-2}^0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\ \end{pmatrix}, \]

then ft_plan_ann2cxf creates the appropriate ft_harmonic_plan, and ft_execute_ann2cxf returns the even Chebyshev–Fourier coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^{-1} & g_0^1 & g_0^{-2} & g_0^2 & \cdots & g_0^{2-2n} & g_0^{2n-2}\\ g_2^0 & g_2^{-1} & g_2^1 & g_2^{-2} & g_2^2 & \cdots & g_2^{2-2n} & g_2^{2n-2}\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ g_{2n-4}^0 & g_{2n-4}^{-1} & g_{2n-4}^1 & g_{2n-4}^{-2} & g_{2n-4}^2 & \cdots & g_{2n-4}^{2-2n} & g_{2n-4}^{2n-2}\\ g_{2n-2}^0 & 0 & 0 & g_{2n-2}^{-2} & g_{2n-2}^2 & \cdots & g_{2n-2}^{2-2n} & g_{2n-2}^{2n-2}\\ \end{pmatrix}. \]

That is:

\[f_{2n-2}(r,\theta) = \sum_{\ell=0}^{n-1}\sum_{m=2-2n}^{2n-2} g_{2\ell}^m \left\{\begin{array}{ccc} T_{\ell}\left(\frac{2r^2-1-\rho^2}{1-\rho^2}\right) & {\rm for} & m~{\rm even},\\ \sqrt{\frac{2}{1-\rho^2}}rT_{\ell}\left(\frac{2r^2-1-\rho^2}{1-\rho^2}\right) & {\rm for} & m~{\rm odd},\end{array}\right\} \sqrt{\frac{2-\delta_{m,0}}{2\pi}}\left\{\begin{array}{ccc} \cos(m\theta) & {\rm for} & m \ge 0,\\ \sin(\abs{m}\theta) & {\rm for} & m < 0,\end{array}\right. \]

and ft_execute_cxf2ann converts them back.

rectdisk2cheb

Real orthonormal Dunkl–Xu polynomials in \(L^2(\mathbb{D}^2, (1-x^2-y^2)^\beta\ud x\ud y)\) are:

\[\tilde{P}_{\ell,m}^{(\beta)}(x,y) = (1-x^2)^{\frac{m}{2}}\tilde{P}_{\ell-m}^{(m+\beta+\frac{1}{2},m+\beta+\frac{1}{2})}(x) \tilde{P}_m^{(\beta,\beta)}\left(\frac{y}{\sqrt{1-x^2}}\right), \]

where the tilde implies that the univariate Jacobi polynomials are orthonormal. A degree- \((n-1)\) expansion in Dunkl–Xu polynomials is given by:

\[f_{n-1}(x,y) = \sum_{\ell=0}^{n-1}\sum_{m=0}^\ell f_\ell^m \tilde{P}_{\ell,m}^{(\beta)}(x,y). \]

If Dunkl–Xu expansion coefficients are organized into the array:

\[F = \begin{pmatrix} f_0^0 & f_1^1 & f_2^2 & \cdots & f_{n-1}^{n-1}\\ \vdots & \vdots & \vdots & \ddots & 0\\ f_{n-3}^0 & f_{n-2}^1 & f_{n-1}^2 & & \vdots\\ f_{n-2}^0 & f_{n-1}^1 & 0 & \cdots & 0\\ f_{n-1}^0 & 0 & 0 & \cdots & 0\\ \end{pmatrix}, \]

then ft_plan_rectdisk2cheb creates the appropriate ft_harmonic_plan, and ft_execute_rectdisk2cheb returns the bivariate (partially weighted) Chebyshev coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^1 & \cdots & g_0^{n-1}\\ g_1^0 & g_1^1 & \cdots & g_1^{n-1}\\ \vdots & \vdots & \ddots & \vdots\\ g_{n-2}^0 & g_{n-2}^1 & \cdots & g_{n-2}^{n-1}\\ g_{n-1}^0 & 0 & \cdots & g_{n-1}^{n-1}\\ \end{pmatrix}. \]

That is:

\[f_{n-1}(x,y) = \sum_{\ell=0}^{n-1}\sum_{m=0}^{n-1} g_\ell^m \left\{\begin{array}{ccc} T_\ell(x) & {\rm for} & m~{\rm even},\\ \sqrt{1-x^2}U_\ell(x) & {\rm for} & m~{\rm odd},\end{array}\right\} T_m\left(\frac{y}{\sqrt{1-x^2}}\right), \]

and ft_execute_cheb2rectdisk converts them back.

tri2cheb

Proriol polynomials on the triangle with vertices \((0,0)\), \((1,0)\), and \((0,1)\) are:

\[\tilde{P}_{\ell,m}^{(\alpha,\beta,\gamma)}(x,y) = (2-2x)^m \tilde{P}_{\ell-m}^{(2m+\beta+\gamma+1,\alpha)}(2x-1) \tilde{P}_m^{(\gamma,\beta)}\left(\frac{2y}{1-x}-1\right), \]

where the tilde implies that the univariate Jacobi polynomials are orthonormal. A degree- \((n-1)\) expansion in Proriol polynomials is given by:

\[f_{n-1}(x,y) = \sum_{\ell=0}^{n-1}\sum_{m=0}^\ell f_\ell^m \tilde{P}_{\ell,m}^{(\alpha,\beta,\gamma)}(x,y). \]

If Proriol expansion coefficients are organized into the array:

\[F = \begin{pmatrix} f_0^0 & f_1^1 & f_2^2 & \cdots & f_{n-1}^{n-1}\\ \vdots & \vdots & \vdots & \ddots & 0\\ f_{n-3}^0 & f_{n-2}^1 & f_{n-1}^2 & & \vdots\\ f_{n-2}^0 & f_{n-1}^1 & 0 & \cdots & 0\\ f_{n-1}^0 & 0 & 0 & \cdots & 0\\ \end{pmatrix}, \]

then ft_plan_tri2cheb creates the appropriate ft_harmonic_plan, and ft_execute_tri2cheb returns the bivariate Chebyshev coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^1 & \cdots & g_0^{n-1}\\ g_1^0 & g_1^1 & \cdots & g_1^{n-1}\\ \vdots & \vdots & \ddots & \vdots\\ g_{n-1}^0 & g_{n-1}^1 & \cdots & g_{n-1}^{n-1}\\ \end{pmatrix}. \]

That is:

\[f_{n-1}(x,y) = \sum_{\ell=0}^{n-1}\sum_{m=0}^{n-1} g_\ell^m T_\ell(2x-1) T_m\left(\frac{2y}{1-x}-1\right), \]

and ft_execute_cheb2tri converts them back.

tet2cheb

Proriol polynomials on the simplex with vertices \((0,0,0)\), \((1,0,0)\), \((0,1,0)\), and \((0,0,1)\) are:

\[\tilde{P}_{k,\ell,m}^{(\alpha,\beta,\gamma,\delta)}(x,y,z) = (2-2x)^{\ell+m} \tilde{P}_{k-\ell-m}^{(2\ell+2m+\beta+\gamma+\delta+2,\alpha)}(2x-1) \left(2-\frac{2y}{1-x}\right)^m \tilde{P}_\ell^{(2m+\gamma+\delta+1,\beta)}\left(\frac{2y}{1-x}-1\right) \tilde{P}_m^{(\delta,\gamma)}\left(\frac{2z}{1-x-y}-1\right), \]

where the tilde implies that the univariate Jacobi polynomials are orthonormal. A degree- \((n-1)\) expansion in Proriol polynomials is given by:

\[f_{n-1}(x,y,z) = \sum_{k=0}^{n-1}\sum_{\ell=0}^k\sum_{m=0}^{k-\ell} f_{k,\ell}^m \tilde{P}_{k,\ell,m}^{(\alpha,\beta,\gamma,\delta)}(x,y,z) = \sum_{m=0}^{n-1}\sum_{\ell=0}^{n-1-m}\sum_{k=\ell+m}^{n-1} f_{k,\ell}^m \tilde{P}_{k,\ell,m}^{(\alpha,\beta,\gamma,\delta)}(x,y,z). \]

If Proriol expansion coefficients are organized into the rank- \(3\) array whose \(m^{\rm th}\) slice is:

\[F[0:n-m-1,0:n-m-1,m] = \begin{pmatrix} f_{m,0}^m & f_{1+m,1}^m & f_{2+m,2}^m & \cdots & f_{n-1,n-1-m}^m\\ \vdots & \vdots & \vdots & \ddots & 0\\ f_{n-3,0}^m & f_{n-2,1}^m & f_{n-1,2}^m & & \vdots\\ f_{n-2,0}^m & f_{n-1,1}^m & 0 & \cdots & 0\\ f_{n-1,0}^m & 0 & 0 & \cdots & 0\\ \end{pmatrix}, \]

then ft_plan_tet2cheb creates the appropriate ft_tetrahedral_harmonic_plan, and ft_execute_tet2cheb returns the trivariate Chebyshev coefficients stored in the rank- \(3\) array \(G\). That is:

\[f_{n-1}(x,y,z) = \sum_{k=0}^{n-1}\sum_{\ell=0}^{n-1}\sum_{m=0}^{n-1} g_{k,\ell}^m T_k(2x-1) T_\ell\left(\frac{2y}{1-x}-1\right) T_m\left(\frac{2z}{1-x-y}-1\right). \]

spinsph2fourier

Complex-valued orthonormal spin-weighted spherical harmonics in \(L^2(\mathbb{S}^2)\) are:

\begin{align*}Y_{\ell,m}^s(\theta,\varphi) & = \frac{e^{\ii m\varphi}}{\sqrt{2\pi}} \sqrt{(\ell+\tfrac{1}{2})\frac{(\ell+\ell_0)!(\ell-\ell_0)!}{(\ell+\ell_1)!(\ell-\ell_1)!}} \sin^{\abs{m+s}}(\tfrac{\theta}{2})\cos^{\abs{m-s}}(\tfrac{\theta}{2}) P_{\ell-\ell_0}^{(\abs{m+s},\abs{m-s})}(\cos\theta), \end{align*}

where \(P_n^{(\alpha,\beta)}(\cos\theta)\) are the Jacobi polynomials and \(\ell_0 = \max\{\abs{m},\abs{s}\}\) and \(\ell_1 = \min\{\abs{m},\abs{s}\}\). A degree- \((n-1)\) expansion in spin-weighted spherical harmonics is given by:

\[f_{n-1}^s(\theta,\varphi) = \sum_{\ell=\ell_0}^{n-1}\sum_{m=-\ell}^{+\ell} f_\ell^m Y_{\ell,m}^s(\theta,\varphi). \]

If spin-weighted spherical harmonic expansion coefficients with \(s=2\), for example, are organized into the array:

\[F = \begin{pmatrix} f_2^0 & f_2^{-1} & f_2^1 & f_2^{-2} & f_2^2 & \cdots & f_{n-1}^{1-n} & f_{n-1}^{n-1}\\ f_3^0 & f_3^{-1} & f_3^1 & f_3^{-2} & f_3^2 & \cdots & 0 & 0\\ \vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ f_{n-1}^0 & f_{n-1}^{-1} & f_{n-1}^1 & f_{n-1}^{-2} & f_{n-1}^2 & & \vdots & \vdots\\ 0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\ 0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\ \end{pmatrix}, \]

then ft_execute_spinsph2fourier returns the bivariate Fourier coefficients:

\[G = \begin{pmatrix} g_0^0 & g_0^{-1} & g_0^1 & \cdots & g_0^{1-n} & g_0^{n-1}\\ g_1^0 & g_1^{-1} & g_1^1 & \cdots & g_1^{1-n} & g_1^{n-1}\\ \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\ g_{n-2}^0 & g_{n-2}^{-1} & g_{n-2}^1& \cdots & g_{n-2}^{1-n} & g_{n-2}^{n-1}\\ g_{n-1}^0 & 0 & 0 & \cdots & g_{n-1}^{1-n} & g_{n-1}^{n-1}\\ \end{pmatrix}. \]

That is:

\[f_{n-1}^s(\theta,\varphi) = \sum_{\ell=0}^{n-1}\sum_{m=1-n}^{n-1} g_\ell^m \frac{e^{\ii m\varphi}}{\sqrt{2\pi}} \left\{\begin{array}{ccc} \cos(\ell\theta) & {\rm for} & m+s~{\rm even},\\ \sin((\ell+1)\theta) & {\rm for} & m+s~{\rm odd}.\end{array}\right. \]

This convention has positive real phase, which implies identities such as:

\[\overline{Y}_{\ell,m}^s(\theta,\varphi) = Y_{\ell,-m}^{-s}(\theta,\varphi). \]

Function arguments

The functions above share a small set of arguments, and their names are used consistently throughout fasttransforms.h.

Arguments of the plans

The pre-computations, ft_plan_a2b, take the size of the problem followed by the parameters of the orthogonal polynomials:

  • n is the \(n\) in the formulas above: the number of rows in the arrays of coefficients \(F\) and \(G\). On the sphere, triangle, rectangularized disk, and tetrahedron, a plan with n transforms expansions of degree at most \(n-1\). On the disk and the annulus, it transforms expansions of degree at most \(2n-2\).
  • alpha, beta, gamma, and delta are the parameters \(\alpha\), \(\beta\), \(\gamma\), and \(\delta\) in the superscripts of the polynomials above. They are the powers that appear in the weight of orthogonality, listed in the table below.
  • rho is the inner radius of the annulus, \(0 < \rho < 1\).
  • s is the integer spin of the spin-weighted spherical harmonics.
Plan Domain Weight
ft_plan_sph2fourier the unit sphere \(1\)
ft_plan_spinsph2fourier the unit sphere \(1\)
ft_plan_disk2cxf the unit disk, \(0\le r<1\) \(r^{2\alpha+1}(1-r^2)^\beta\) in polar coordinates
ft_plan_ann2cxf the annulus, \(\rho<r<1\) \(r^{2\gamma+1}(r^2-\rho^2)^\alpha(1-r^2)^\beta\) in polar coordinates
ft_plan_rectdisk2cheb the unit disk, \(x^2+y^2<1\) \((1-x^2-y^2)^\beta\)
ft_plan_tri2cheb the triangle, \(x,y>0\) and \(x+y<1\) \(x^\alpha y^\beta(1-x-y)^\gamma\)
ft_plan_tet2cheb the tetrahedron, \(x,y,z>0\) and \(x+y+z<1\) \(x^\alpha y^\beta z^\gamma(1-x-y-z)^\delta\)

Arguments of the executions

The drivers, ft_execute_a2b and ft_execute_b2a, all have the form (TRANS, P, A, N, M), with an additional L on the tetrahedron:

  • TRANS is a character that selects the operation: 'N' applies the transform as it is defined above, and 'T' applies its transpose.
  • P is the plan that is returned by the corresponding ft_plan_a2b. A plan may be reused for any number of executions.
  • A is the array of coefficients. It is overwritten by the result: on entry to ft_execute_a2b, it stores \(F\), zeros included, and on exit it stores \(G\), and vice versa for ft_execute_b2a. The array is stored in column-major ordering, so that the entry in row \(i\) and column \(j\), counting from zero, is A[i+N*j]. On the tetrahedron, the entry in row \(i\), column \(j\), and slice \(k\) is A[i+N*(j+L*k)].
  • N is the number of rows of A. It must be equal to the n that created the plan.
  • M is the number of columns of A. The arrays \(F\) and \(G\) above are shown with all of their columns, and this number depends on the transform, as in the table below.
  • L appears only on the tetrahedron, where A is an \(N\times L\times M\) array: L is the number of columns and M is the number of slices.
Transform Size of A for a plan with n
sph2fourier and spinsph2fourier \(N\times M = n\times(2n-1)\)
disk2cxf and ann2cxf \(N\times M = n\times(4n-3)\)
rectdisk2cheb and tri2cheb \(N\times M = n\times n\)
tet2cheb \(N\times L\times M = n\times n\times n\)

For the spin-weighted spherical harmonics, the coefficients are complex and A is an array of ft_complex.

Arguments of the conversions and the kernels

The conversions to and from a tensor-product basis, ft_execute_a_hi2lo and ft_execute_a_lo2hi, have the form (RP, A, B, M):

  • RP is a ft_rotation_plan that stores the sines and the cosines of the Givens rotations, such as the one returned by ft_plan_rotsphere. For the spin-weighted spherical harmonics, it is a ft_spin_rotation_plan called SRP. A ft_harmonic_plan stores its own rotation plans.
  • A and M are the array of coefficients and its number of columns, as above. The number of rows is the n that created the rotation plan.
  • B is a work array of the same size as A. Its contents on entry are ignored.

On the tetrahedron, the form is (RP1, RP2, A, L, M), with two rotation plans, no work array, and L and M as above.

The computational kernels, ft_kernel_a_hi2lo and ft_kernel_a_lo2hi, have the form (RP, m1, m2, A, S) and act on a single column of coefficients:

  • m1 and m2 are the low and the high orders, m1 \(\le\) m2, where the order is the index \(m\) in the formulas above. The kernel hi2lo converts coefficients from order m2 down to order m1 and lo2hi converts them back. On the sphere, the disk, and the rectangularized disk, a conversion preserves the parity of the order, so that m2 \(-\) m1 is even.
  • A points to the first coefficient in the column.
  • S is the stride: consecutive coefficients are stored in A[0], A[S], A[2*S], and so on. A stride of 1 acts on one column of a column-major array.

For the spin-weighted spherical harmonics, the form is (SRP, m, A, S), and the kernels convert between order m and order m%2.

Under construction

sgl2cxf

Spherical Gauss–Laguerre functions are:

\[\psi_{k,\ell,m}(r,\theta,\varphi) = r^\ell \tilde{L}_{k-\ell}^{(2\ell+2)}(r) Y_\ell^m(\theta,\varphi), \]

where the \(Y_\ell^m(\theta,\varphi)\) are spherical harmonics, and the \(\tilde{L}_n^{(\alpha)}(r)\) are normalized generalized Laguerre polynomials. A degree- \((n-1)\) expansion in spherical Gauss–Laguerre functions is given by:

\[f_{n-1}(r,\theta,\varphi) = \sum_{k=0}^{n-1}\sum_{\ell=0}^k\sum_{m=-\ell}^{+\ell}f_{k,\ell}^m \psi_{k,\ell,m}(r,\theta,\varphi). \]