Harmonic polynomial transforms

The transforms on this page convert an expansion in orthonormal polynomials on a domain, such as spherical harmonics on the sphere or Zernike polynomials on the disk, to an expansion in a tensor-product basis of Chebyshev polynomials and Fourier modes, and back. They wrap the C library FastTransforms, whose documentation is the reference for the definitions of the polynomials.

This page describes how the arrays of coefficients are laid out in Julia, and what the transforms require of them.

Summary

DomainForwardInverseSize of the arrayMaximum degree
Spheresph2fourierfourier2sphn × (2n-1)n-1
Sphere, with spinplan_spinsph2fouriern × (2n-1), complexn-1
Diskdisk2cxfcxf2diskn × (4n-3)2n-2
Annulusann2cxfcxf2annn × (4n-3)2n-2
Rectangularized diskrectdisk2chebcheb2rectdiskn × nn-1
Triangletri2chebcheb2trin × nn-1
Tetrahedrontet2chebcheb2tetn × n × nn-1

Three things hold for all of them, and each is explained below:

  1. The size n is the number of rows of the array. It is not the degree.
  2. Only some of the entries of the input store a coefficient.
  3. The other entries must be zero. They are not ignored.

The size of the arrays

Every transform is determined by the number of rows n of the array. This is the n in the documentation of the C library, where it is also called N. It counts coefficients, so the smallest problem is n = 1, a 1 × 1 array that stores the coefficient of the constant:

julia> disk2cxf(fill(1.0, 1, 1))
1×1 Matrix{Float64}:
 1.4142135623730951

There is no n = 0 case: the number of columns, 4n-3 on the disk, would be negative.

The number of columns follows from n as in the table above. On the sphere, the disk, and the annulus, the columns are ordered by the order m of the Fourier mode, m = 0, -1, 1, -2, 2, …, and so the number of columns is odd.

Plans

A transform consists of a precomputation that depends only on n and the parameters of the polynomials, and an execution. The functions in the table do both. To reuse the precomputation, create a plan:

using FastTransforms, LinearAlgebra

F = diskrandn(Float64, 10, 37)   # n = 10, 4n-3 = 37
P = plan_disk2cxf(F, 0, 0)       # or plan_disk2cxf(Float64, 10, 0, 0)

G = P*F       # the forward transform, the same as disk2cxf(F, 0, 0)
P\G ≈ F       # the inverse transform, the same as cxf2disk(G, 0, 0)

lmul!(P, F)   # the forward transform, overwriting F
ldiv!(P, F)   # the inverse transform, overwriting F

P*F and P\G copy their argument, and lmul! and ldiv! work in place.

Where the coefficients are stored

The polynomials of degree at most a given number do not fill a rectangular array, and so the input of a forward transform is only partially used. For example, there is one Zernike polynomial of degree 0, two of degree 1, and three of degree 2. With n = 2, disk2cxf acts on the six coefficients $f_\ell^m$ of degree $\ell \le 2$ and order $m$, stored in a 2 × 5 array as:

\[F = \begin{pmatrix} f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2\\ f_2^0 & 0 & 0 & 0 & 0 \end{pmatrix}.\]

The functions diskones, sphones, triones, and so on return an array with a one in every entry that stores a coefficient, which shows the pattern:

julia> diskones(Float64, 3, 9)
3×9 Matrix{Float64}:
 1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  1.0  1.0  0.0  0.0  0.0  0.0
 1.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0

julia> sphones(Float64, 3, 5)
3×5 Matrix{Float64}:
 1.0  1.0  1.0  1.0  1.0
 1.0  1.0  1.0  0.0  0.0
 1.0  0.0  0.0  0.0  0.0

julia> triones(Float64, 3, 3)
3×3 Matrix{Float64}:
 1.0  1.0  1.0
 1.0  1.0  0.0
 1.0  0.0  0.0

The rule for each transform is given in The transforms below.

The other entries must be zero

The entries of the input that do not store a coefficient are not ignored. A transform works in place on the whole array, and the output generally has more nonzero entries than the input:

julia> F = [1.0 2.0 3.0 4.0 5.0
            6.0 0.0 0.0 0.0 0.0];

julia> G = disk2cxf(F)
2×5 Matrix{Float64}:
  1.41421  4.0  6.0  4.89898  6.12372
 14.6969   0.0  0.0  4.89898  6.12372

julia> cxf2disk(G) ≈ F
true

To compute the output, the transform reads every entry of the input, and it assumes that the entries which do not store a coefficient are zero. If they are not, then the output is wrong. In particular, they cannot be used to mark unused storage:

julia> F[2, 2:end] .= NaN;

julia> disk2cxf(F)
2×5 Matrix{Float64}:
  1.41421  NaN  NaN  NaN  NaN
 14.6969   NaN  NaN  NaN  NaN

The reason is that a column of the array is converted by a sequence of Givens rotations, each acting on two entries of the column, followed by a multiplication of the whole column by a triangular matrix. Both steps combine the entries that store coefficients with those that do not.

To create an array with the right pattern of zeros, start from the functions that end in zeros, ones, rand, or randn:

FastTransforms.sphzeros — Function
sphzeros(T, n, 2n-1)
sphones(T, n, 2n-1)
sphrand(T, n, 2n-1)
sphrandn(T, n, 2n-1)

Return an n × (2n-1) array of element type T of spherical harmonic coefficients for sph2fourier. Every entry that stores a coefficient is zero, one, uniformly random, or normally random, respectively, and every other entry is zero.

source
FastTransforms.diskzeros — Function
diskzeros(T, n, 4n-3)
diskones(T, n, 4n-3)
diskrand(T, n, 4n-3)
diskrandn(T, n, 4n-3)

Return an n × (4n-3) array of element type T of Zernike coefficients for disk2cxf, or of annulus polynomial coefficients for ann2cxf. Every entry that stores a coefficient is zero, one, uniformly random, or normally random, respectively, and every other entry is zero.

source
FastTransforms.trizeros — Function
trizeros(T, n, n)
triones(T, n, n)
trirand(T, n, n)
trirandn(T, n, n)

Return an n × n array of element type T of Proriol coefficients for tri2cheb. The functions rectdiskzeros, rectdiskones, rectdiskrand, and rectdiskrandn are the same, for the Dunkl–Xu coefficients of rectdisk2cheb. Every entry that stores a coefficient is zero, one, uniformly random, or normally random, respectively, and every other entry is zero.

source
FastTransforms.tetzeros — Function
tetzeros(T, n, n, n)
tetones(T, n, n, n)
tetrand(T, n, n, n)
tetrandn(T, n, n, n)

Return an n × n × n array of element type T of Proriol coefficients for tet2cheb. Every entry that stores a coefficient is zero, one, uniformly random, or normally random, respectively, and every other entry is zero.

source
FastTransforms.spinsphzeros — Function
spinsphzeros(T, n, 2n-1)
spinsphones(T, n, 2n-1, s)
spinsphrand(T, n, 2n-1, s)
spinsphrandn(T, n, 2n-1, s)

Return an n × (2n-1) array of element type T of spin-weighted spherical harmonic coefficients with spin s for plan_spinsph2fourier. Every entry that stores a coefficient is zero, one, uniformly random, or normally random, respectively, and every other entry is zero.

source

The transforms

In all of the following, the first index of a coefficient, usually $\ell$, is the degree of the polynomial, and a tilde over a univariate polynomial means that it is orthonormal. On the sphere, the disk, and the annulus, column 1 stores the order $m = 0$, and columns 2j and 2j+1 store the orders $m = -j$ and $m = j$.

Sphere

The input stores the coefficients $f_\ell^m$ of real orthonormal spherical harmonics, for $0 \le \ell \le n-1$ and $-\ell \le m \le \ell$:

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

In the column of order $m$, row i stores $f_{|m|+i-1}^m$, for i = 1:n-|m|. The output stores the coefficients $g_\ell^m$ of the bivariate Fourier series:

\[\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(|m|\varphi) & {\rm for} & m < 0,\end{array}\right.\]

with $g_\ell^m$ in row ℓ+1 of the column of order $m$.

FastTransforms.sph2fourier — Function
sph2fourier(F::AbstractMatrix)

Convert the n × (2n-1) array F of real orthonormal spherical harmonic coefficients to an array of the same size of bivariate Fourier coefficients. An array with n rows stores an expansion of degree at most n-1.

The first column of F stores the order m = 0, and columns 2j and 2j+1 store the orders m = -j and m = j. In the column of order m, the coefficients of degrees |m|, |m|+1, …, n-1 are stored in rows 1:n-|m|.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use sphzeros to create an array with the right pattern of zeros.

See also fourier2sph for the inverse and plan_sph2fourier to reuse the precomputation.

source
FastTransforms.fourier2sph — Function
fourier2sph(G::AbstractMatrix)

Convert the n × (2n-1) array G of bivariate Fourier coefficients to an array of the same size of real orthonormal spherical harmonic coefficients. This is the inverse of sph2fourier, where the arrays and the parameters are described.

source
FastTransforms.plan_sph2fourier — Function
plan_sph2fourier(F::AbstractMatrix)
plan_sph2fourier(Float64, n::Integer)

Precompute the conversion between real orthonormal spherical harmonic coefficients and bivariate Fourier coefficients, for n × (2n-1) arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as sph2fourier and P\G is the same as fourier2sph. lmul!(P, F) and ldiv!(P, G) do the same in place.

source

Sphere, with spin

The input stores the complex coefficients $f_\ell^m$ of spin-weighted spherical harmonics with integer spin $s$, for $\ell_0 \le \ell \le n-1$ and $-\ell \le m \le \ell$, where $\ell_0 = \max\{|m|,|s|\}$. In the column of order $m$, row i stores $f_{\ell_0+i-1}^m$, for i = 1:n-ℓ₀. The output stores the coefficients $g_\ell^m$ of the bivariate Fourier series:

\[\sum_{\ell=0}^{n-1}\sum_{m=1-n}^{n-1} g_\ell^m \frac{e^{{\rm i} 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.\]

with $g_\ell^m$ in row ℓ+1 of the column of order $m$.

FastTransforms.plan_spinsph2fourier — Function
plan_spinsph2fourier(F::AbstractMatrix{<:Complex}, s::Integer)
plan_spinsph2fourier(ComplexF64, n::Integer, s::Integer)

Precompute the conversion between spin-weighted spherical harmonic coefficients with spin s and bivariate Fourier coefficients, for complex n × (2n-1) arrays. The size n is the number of rows of F, and an array with n rows stores an expansion of degree at most n-1.

For a plan P, P*F is the forward transform and P\G is its inverse. lmul!(P, F) and ldiv!(P, G) do the same in place.

The first column of F stores the order m = 0, and columns 2j and 2j+1 store the orders m = -j and m = j. In the column of order m, the coefficients of degrees ℓ₀, ℓ₀+1, …, n-1 are stored in rows 1:n-ℓ₀, where ℓ₀ = max(|m|, |s|).

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use spinsphzeros to create an array with the right pattern of zeros.

source

Disk

The input stores the coefficients $f_\ell^m$ of real orthonormal generalized Zernike polynomials, for $0 \le \ell \le 2n-2$ and $m = -\ell, -\ell+2, \ldots, \ell$:

\[Z_{\ell,m}^{(\alpha,\beta)}(r,\theta) = 2^{\frac{|m|+\alpha+\beta+2}{2}} r^{|m|}\tilde{P}_{\frac{\ell-|m|}{2}}^{(\beta,|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(|m|\theta) & {\rm for} & m < 0.\end{array}\right.\]

They are orthonormal with respect to the weight $r^{2\alpha+1}(1-r^2)^\beta{\rm\,d}r{\rm\,d}\theta$ on the unit disk, so that $\alpha = \beta = 0$ are the Zernike polynomials. In the column of order $m$, row i stores $f_{|m|+2i-2}^m$, for i = 1:n-⌈|m|/2⌉. The output stores the coefficients $g_{2\ell}^m$ of the Chebyshev×Fourier series:

\[\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(|m|\theta) & {\rm for} & m < 0,\end{array}\right.\]

with $g_{2\ell}^m$ in row ℓ+1 of the column of order $m$.

FastTransforms.disk2cxf — Function
disk2cxf(F::AbstractMatrix, α = 0, β = 0)

Convert the n × (4n-3) array F of real orthonormal generalized Zernike coefficients to an array of the same size of Chebyshev×Fourier coefficients. An array with n rows stores an expansion of degree at most 2n-2. The polynomials are orthonormal with respect to the weight r^(2α+1) (1-r^2)^β dr dθ on the unit disk.

The first column of F stores the order m = 0, and columns 2j and 2j+1 store the orders m = -j and m = j. In the column of order m, the coefficients of degrees |m|, |m|+2, … up to 2n-2 are stored in rows 1:n-⌈|m|/2⌉.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use diskzeros to create an array with the right pattern of zeros.

See also cxf2disk for the inverse and plan_disk2cxf to reuse the precomputation.

source
FastTransforms.cxf2disk — Function
cxf2disk(G::AbstractMatrix, α = 0, β = 0)

Convert the n × (4n-3) array G of Chebyshev×Fourier coefficients to an array of the same size of real orthonormal generalized Zernike coefficients. This is the inverse of disk2cxf, where the arrays and the parameters are described.

source
FastTransforms.plan_disk2cxf — Function
plan_disk2cxf(F::AbstractMatrix, α = 0, β = 0)
plan_disk2cxf(Float64, n::Integer, α = 0, β = 0)

Precompute the conversion between real orthonormal generalized Zernike coefficients and Chebyshev×Fourier coefficients, for n × (4n-3) arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as disk2cxf and P\G is the same as cxf2disk. lmul!(P, F) and ldiv!(P, G) do the same in place.

source

Annulus

The input stores the coefficients of real orthonormal annulus polynomials $Z_{\ell,m}^{\rho,(\alpha,\beta,\gamma)}(r,\theta)$, in the same layout as on the disk. They are orthonormal with respect to the weight $r^{2\gamma+1}(r^2-\rho^2)^\alpha(1-r^2)^\beta{\rm\,d}r{\rm\,d}\theta$ on the annulus $\rho < r < 1$. The output stores the coefficients $g_{2\ell}^m$ of the Chebyshev×Fourier series:

\[\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(|m|\theta) & {\rm for} & m < 0,\end{array}\right.\]

with $g_{2\ell}^m$ in row ℓ+1 of the column of order $m$.

FastTransforms.ann2cxf — Function
ann2cxf(F::AbstractMatrix, α, β, γ, ρ)

Convert the n × (4n-3) array F of real orthonormal annulus polynomial coefficients to an array of the same size of Chebyshev×Fourier coefficients. An array with n rows stores an expansion of degree at most 2n-2. The polynomials are orthonormal with respect to the weight r^(2γ+1) (r^2-ρ^2)^α (1-r^2)^β dr dθ on the annulus ρ < r < 1.

The first column of F stores the order m = 0, and columns 2j and 2j+1 store the orders m = -j and m = j. In the column of order m, the coefficients of degrees |m|, |m|+2, … up to 2n-2 are stored in rows 1:n-⌈|m|/2⌉, as in disk2cxf.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use diskzeros to create an array with the right pattern of zeros.

See also cxf2ann for the inverse and plan_ann2cxf to reuse the precomputation.

source
FastTransforms.cxf2ann — Function
cxf2ann(G::AbstractMatrix, α, β, γ, ρ)

Convert the n × (4n-3) array G of Chebyshev×Fourier coefficients to an array of the same size of real orthonormal annulus polynomial coefficients. This is the inverse of ann2cxf, where the arrays and the parameters are described.

source
FastTransforms.plan_ann2cxf — Function
plan_ann2cxf(F::AbstractMatrix, α, β, γ, ρ)
plan_ann2cxf(Float64, n::Integer, α, β, γ, ρ)

Precompute the conversion between real orthonormal annulus polynomial coefficients and Chebyshev×Fourier coefficients, for n × (4n-3) arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as ann2cxf and P\G is the same as cxf2ann. lmul!(P, F) and ldiv!(P, G) do the same in place.

source

Rectangularized disk

The input stores the coefficients $f_\ell^m$ of real orthonormal Dunkl–Xu polynomials, for $0 \le m \le \ell \le n-1$:

\[\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).\]

They are orthonormal with respect to the weight $(1-x^2-y^2)^\beta$ on the unit disk. Column m+1 stores the order $m$, and its row i stores $f_{m+i-1}^m$, for i = 1:n-m. The output stores the coefficients $g_\ell^m$ of the partially weighted Chebyshev series:

\[\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),\]

with $g_\ell^m$ in row ℓ+1 and column m+1.

FastTransforms.rectdisk2cheb — Function
rectdisk2cheb(F::AbstractMatrix, β = 0)

Convert the n × n array F of real orthonormal Dunkl–Xu coefficients to an array of the same size of partially weighted bivariate Chebyshev coefficients. An array with n rows stores an expansion of degree at most n-1. The polynomials are orthonormal with respect to the weight (1-x^2-y^2)^β on the unit disk.

Column m+1 of F stores the order m: the coefficients of degrees m, m+1, …, n-1 are stored in rows 1:n-m.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use trizeros to create an array with the right pattern of zeros.

See also cheb2rectdisk for the inverse and plan_rectdisk2cheb to reuse the precomputation.

source
FastTransforms.cheb2rectdisk — Function
cheb2rectdisk(G::AbstractMatrix, β = 0)

Convert the n × n array G of partially weighted bivariate Chebyshev coefficients to an array of the same size of real orthonormal Dunkl–Xu coefficients. This is the inverse of rectdisk2cheb, where the arrays and the parameters are described.

source
FastTransforms.plan_rectdisk2cheb — Function
plan_rectdisk2cheb(F::AbstractMatrix, β = 0)
plan_rectdisk2cheb(Float64, n::Integer, β = 0)

Precompute the conversion between real orthonormal Dunkl–Xu coefficients and partially weighted bivariate Chebyshev coefficients, for n × n arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as rectdisk2cheb and P\G is the same as cheb2rectdisk. lmul!(P, F) and ldiv!(P, G) do the same in place.

source

Triangle

The input stores the coefficients $f_\ell^m$ of Proriol polynomials on the triangle with vertices $(0,0)$, $(1,0)$, and $(0,1)$, for $0 \le m \le \ell \le n-1$:

\[\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).\]

They are orthogonal with respect to the weight $x^\alpha y^\beta(1-x-y)^\gamma$. Column m+1 stores the order $m$, and its row i stores $f_{m+i-1}^m$, for i = 1:n-m. The output stores the coefficients $g_\ell^m$ of the bivariate Chebyshev series:

\[\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),\]

with $g_\ell^m$ in row ℓ+1 and column m+1.

FastTransforms.tri2cheb — Function
tri2cheb(F::AbstractMatrix, α = 0, β = 0, γ = 0)

Convert the n × n array F of Proriol polynomial coefficients to an array of the same size of bivariate Chebyshev coefficients. An array with n rows stores an expansion of degree at most n-1. The polynomials are orthogonal with respect to the weight x^α y^β (1-x-y)^γ on the triangle with vertices (0,0), (1,0), and (0,1).

Column m+1 of F stores the order m: the coefficients of degrees m, m+1, …, n-1 are stored in rows 1:n-m.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use trizeros to create an array with the right pattern of zeros.

See also cheb2tri for the inverse and plan_tri2cheb to reuse the precomputation.

source
FastTransforms.cheb2tri — Function
cheb2tri(G::AbstractMatrix, α = 0, β = 0, γ = 0)

Convert the n × n array G of bivariate Chebyshev coefficients to an array of the same size of Proriol polynomial coefficients. This is the inverse of tri2cheb, where the arrays and the parameters are described.

source
FastTransforms.plan_tri2cheb — Function
plan_tri2cheb(F::AbstractMatrix, α = 0, β = 0, γ = 0)
plan_tri2cheb(Float64, n::Integer, α = 0, β = 0, γ = 0)

Precompute the conversion between Proriol polynomial coefficients and bivariate Chebyshev coefficients, for n × n arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as tri2cheb and P\G is the same as cheb2tri. lmul!(P, F) and ldiv!(P, G) do the same in place.

source

Tetrahedron

The input stores the coefficients $f_{k,\ell}^m$ of Proriol polynomials on the tetrahedron with vertices $(0,0,0)$, $(1,0,0)$, $(0,1,0)$, and $(0,0,1)$, for $\ell, m \ge 0$ and $\ell + m \le k \le n-1$, where $k$ is the degree:

\[\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).\]

They are orthogonal with respect to the weight $x^\alpha y^\beta z^\gamma(1-x-y-z)^\delta$. The entry F[i, ℓ+1, m+1] stores $f_{\ell+m+i-1,\ell}^m$, for i = 1:n-ℓ-m. The output stores the coefficients $g_{k,\ell}^m$ of the trivariate Chebyshev series:

\[\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),\]

with $g_{k,\ell}^m$ in the entry G[k+1, ℓ+1, m+1].

FastTransforms.tet2cheb — Function
tet2cheb(F::AbstractArray{<:Any,3}, α = 0, β = 0, γ = 0, δ = 0)

Convert the n × n × n array F of Proriol polynomial coefficients to an array of the same size of trivariate Chebyshev coefficients. An array with n rows stores an expansion of degree at most n-1. The polynomials are orthogonal with respect to the weight x^α y^β z^γ (1-x-y-z)^δ on the tetrahedron with vertices (0,0,0), (1,0,0), (0,1,0), and (0,0,1).

The entries F[i, ℓ+1, m+1] with i = 1:n-ℓ-m store the coefficients of degrees ℓ+m, ℓ+m+1, …, n-1.

The entries of F that do not store a coefficient must be zero. They are not ignored: the transform reads them as part of the input and overwrites them with part of the output. Use tetzeros to create an array with the right pattern of zeros.

See also cheb2tet for the inverse and plan_tet2cheb to reuse the precomputation.

source
FastTransforms.cheb2tet — Function
cheb2tet(G::AbstractArray{<:Any,3}, α = 0, β = 0, γ = 0, δ = 0)

Convert the n × n × n array G of trivariate Chebyshev coefficients to an array of the same size of Proriol polynomial coefficients. This is the inverse of tet2cheb, where the arrays and the parameters are described.

source
FastTransforms.plan_tet2cheb — Function
plan_tet2cheb(F::AbstractArray{<:Any,3}, α = 0, β = 0, γ = 0, δ = 0)
plan_tet2cheb(Float64, n::Integer, α = 0, β = 0, γ = 0, δ = 0)

Precompute the conversion between Proriol polynomial coefficients and trivariate Chebyshev coefficients, for n × n × n arrays. The size n is the number of rows of F.

For a plan P, P*F is the same as tet2cheb and P\G is the same as cheb2tet. lmul!(P, F) and ldiv!(P, G) do the same in place.

source