Skip to content

Commit 6c12ad5

Browse files
start adding docs
1 parent 42c6479 commit 6c12ad5

File tree

5 files changed

+157
-4
lines changed

5 files changed

+157
-4
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ As with other fast transforms, `plan_sph2fourier` saves effort by caching the pr
126126

127127
[2] N. Hale and A. Townsend. <a href="http://dx.doi.org/10.1137/130932223">A fast, simple, and stable Chebyshev—Legendre transform using and asymptotic formula</a>, *SIAM J. Sci. Comput.*, **36**:A148—A167, 2014.
128128

129-
[3] R. M. Slevinsky. <a href="https://doi.org/10.1093/imanum/drw070">On the use of Hahn's asymptotic formula and stabilized recurrence for a fast, simple, and stable Chebyshev—Jacobi transform</a>, published online in *IMA J. Numer. Anal.*, 2017.
129+
[3] J. Keiner. <a href="http://dx.doi.org/10.1137/070703065">Computing with expansions in Gegenbauer polynomials</a>, *SIAM J. Sci. Comput.*, **31**:2151—2171, 2009.
130130

131-
[4] R. M. Slevinsky. <a href="https://arxiv.org/abs/">Fast and backward stable transforms between spherical harmonic expansions and bivariate Fourier series</a>, arXiv, 2017.
131+
[4] R. M. Slevinsky. <a href="https://doi.org/10.1093/imanum/drw070">On the use of Hahn's asymptotic formula and stabilized recurrence for a fast, simple, and stable Chebyshev—Jacobi transform</a>, in press at *IMA J. Numer. Anal.*, 2017.
132132

133-
[5] A. Townsend, M. Webb, and S. Olver. <a href="http://arxiv.org/abs/1604.07486">Fast polynomial transforms based on Toeplitz and Hankel matrices</a>, arXiv:1604.07486, 2016.
133+
[5] R. M. Slevinsky. <a href="https://arxiv.org/abs/">Fast and backward stable transforms between spherical harmonic expansions and bivariate Fourier series</a>, arXiv, 2017.
134+
135+
[6] A. Townsend, M. Webb, and S. Olver. <a href="https://doi.org/10.1090/mcom/3277">Fast polynomial transforms based on Toeplitz and Hankel matrices</a>, in press at *Math. Comp.*, 2017.

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ deploydocs(
1818
julia = "0.5",
1919
osname = "linux",
2020
target = "build",
21-
deps = nothing,
21+
deps = Deps.pip("pygments", "mkdocs", "python-markdown-math"),
2222
make = nothing
2323
)

docs/src/index.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
# FastTransforms.jl Documentation
22

3+
## Introduction
4+
5+
In numerical analysis, it is customary to expand a function in a basis:
6+
```math
7+
f(x) = \sum_{\ell = 0}^{n} f_{\ell} \phi_{\ell}(x).
8+
```
9+
Orthogonal polynomials are examples of convenient bases for sufficiently smooth functions. To perform some operation, it may be necessary to convert our representation to one in a new basis, say, ``\{\psi_m(x)\}_{m\ge0}``.
10+
11+
If each function ``\phi_{\ell}`` is expanded in the basis ``\psi_m``, such as:
12+
```math
13+
\phi_{\ell}(x) \sim \sum_{m=0}^{\infty} c_{m,\ell}\psi_{m}(x),
14+
```
15+
then our original function has the alternative representation:
16+
```math
17+
f(x) \sim \sum_{m = 0}^{\infty} g_m \psi_m(x),
18+
```
19+
where ``g_m`` are defined by the sum:
20+
```math
21+
g_m = \sum_{\ell = 0}^{n} c_{m,\ell} f_{\ell}.
22+
```
23+
24+
This is the classical connection problem. In many cases of interest, the both representations are finite and we seek a fast method (faster than ``\mathcal{O}(n^2)``) to transform the coefficients ``f_{\ell}`` to ``g_m``. These are the fast transforms.
325

426
## Fast Transforms
527

28+
```@docs
29+
leg2cheb
30+
```
31+
32+
```@docs
33+
cheb2leg
34+
```
35+
36+
```@docs
37+
plan_leg2cheb
38+
```
39+
40+
```@docs
41+
plan_cheb2leg
42+
```
43+
644
```@docs
745
cjt
846
```
@@ -39,6 +77,18 @@ plan_paduatransform!
3977
plan_ipaduatransform!
4078
```
4179

80+
```@docs
81+
sph2fourier
82+
```
83+
84+
```@docs
85+
fourier2sph
86+
```
87+
88+
```@docs
89+
plan_sph2fourier
90+
```
91+
4292
## Other Exported Methods
4393

4494
```@docs

src/SphericalHarmonics/SphericalHarmonics.jl

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,76 @@ end
3636

3737
sph2fourier(A::AbstractMatrix; opts...) = plan_sph2fourier(A; opts...)*A
3838
fourier2sph(A::AbstractMatrix; opts...) = plan_sph2fourier(A; opts...)\A
39+
40+
doc"""
41+
Computes the bivariate Fourier series given by the spherical harmonic expansion:
42+
43+
```math
44+
{\rm SHT} : \sum_{\ell=0}^n\sum_{m=-\ell}^{\ell} f_{\ell}^m Y_{\ell}^m(\theta,\varphi) \to \sum_{\ell=0}^n\sum_{m=-n}^{n} g_{\ell}^m \frac{e^{{\rm i} m \varphi}}{\sqrt{2\pi}} \left\{\begin{array}{c}\cos\ell\theta\\ \sin(\ell+1)\theta\end{array}\right\},
45+
```
46+
47+
where the cosines are used when ``m`` is even and the sines are used when ``m`` is odd. The spherical harmonic expansion coefficients are organized as follows:
48+
49+
```math
50+
F = \begin{pmatrix}
51+
f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2 & \cdots & f_n^{-n} & f_n^n\\
52+
f_1^0 & f_2^{-1} & f_2^1 & f_3^{-2} & f_3^2 & \cdots & 0 & 0\\
53+
\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
54+
f_{n-2}^0 & f_{n-1}^{-1} & f_{n-1}^1 & f_n^{-2} & f_n^2 & & \vdots & \vdots\\
55+
f_{n-1}^0 & f_n^{-1} & f_n^1 & 0 & 0 & \cdots & 0 & 0\\
56+
f_n^0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\
57+
\end{pmatrix},
58+
```
59+
60+
and the Fourier coefficients are organized similarly:
61+
62+
```math
63+
G = \begin{pmatrix}
64+
g_0^0 & g_0^{-1} & g_0^1 & \cdots & g_0^{-n} & g_0^n\\
65+
g_1^0 & g_1^{-1} & g_1^1 & \cdots & g_1^{-n} & g_1^n\\
66+
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
67+
g_{n-1}^0 & g_{n-1}^{-1} & g_{n-1}^1& \cdots & g_{n-1}^{-n} & g_{n-1}^n\\
68+
g_n^0 & 0 & 0 & \cdots & g_n^{-n} & g_n^n\\
69+
\end{pmatrix}.
70+
```
71+
"""
72+
sph2fourier(::AbstractMatrix; opts...)
73+
74+
doc"""
75+
Computes the spherical harmonic expansion given by the bivariate Fourier series:
76+
77+
```math
78+
{\rm iSHT} : \sum_{\ell=0}^n\sum_{m=-n}^{n} g_{\ell}^m \frac{e^{{\rm i} m \varphi}}{\sqrt{2\pi}} \left\{\begin{array}{c}\cos\ell\theta\\ \sin(\ell+1)\theta\end{array}\right\} \to \sum_{\ell=0}^n\sum_{m=-\ell}^{\ell} f_{\ell}^m Y_{\ell}^m(\theta,\varphi),
79+
```
80+
81+
where the cosines are used when ``m`` is even and the sines are used when ``m`` is odd. The spherical harmonic expansion coefficients are organized as follows:
82+
83+
```math
84+
F = \begin{pmatrix}
85+
f_0^0 & f_1^{-1} & f_1^1 & f_2^{-2} & f_2^2 & \cdots & f_n^{-n} & f_n^n\\
86+
f_1^0 & f_2^{-1} & f_2^1 & f_3^{-2} & f_3^2 & \cdots & 0 & 0\\
87+
\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
88+
f_{n-2}^0 & f_{n-1}^{-1} & f_{n-1}^1 & f_n^{-2} & f_n^2 & & \vdots & \vdots\\
89+
f_{n-1}^0 & f_n^{-1} & f_n^1 & 0 & 0 & \cdots & 0 & 0\\
90+
f_n^0 & 0 & 0 & 0 & 0 & \cdots & 0 & 0\\
91+
\end{pmatrix},
92+
```
93+
94+
and the Fourier coefficients are organized similarly:
95+
96+
```math
97+
G = \begin{pmatrix}
98+
g_0^0 & g_0^{-1} & g_0^1 & \cdots & g_0^{-n} & g_0^n\\
99+
g_1^0 & g_1^{-1} & g_1^1 & \cdots & g_1^{-n} & g_1^n\\
100+
\vdots & \vdots & \vdots & \ddots & \vdots & \vdots\\
101+
g_{n-1}^0 & g_{n-1}^{-1} & g_{n-1}^1& \cdots & g_{n-1}^{-n} & g_{n-1}^n\\
102+
g_n^0 & 0 & 0 & \cdots & g_n^{-n} & g_n^n\\
103+
\end{pmatrix}.
104+
```
105+
"""
106+
fourier2sph(::AbstractMatrix; opts...)
107+
108+
doc"""
109+
Pre-computes the spherical harmonic transform.
110+
"""
111+
plan_sph2fourier(::AbstractMatrix; opts...)

src/hierarchical.jl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,3 +439,31 @@ ChebyshevToNormalizedLegendrePlan(v::VecOrMat) = ChebyshevToNormalizedLegendrePl
439439

440440
NormalizedLegendre1ToChebyshev2Plan(v::VecOrMat) = NormalizedLegendre1ToChebyshev2Plan(plan_even_normleg12cheb2(v), plan_odd_normleg12cheb2(v), eltype(v)[sqrt((j+0.5)/(j*(j+1))) for j in 1:size(v, 1)])
441441
Chebyshev2ToNormalizedLegendre1Plan(v::VecOrMat) = Chebyshev2ToNormalizedLegendre1Plan(plan_even_cheb22normleg1(v), plan_odd_cheb22normleg1(v), eltype(v)[sqrt(i*(i+1)/(i+0.5)) for i in 1:size(v, 1)])
442+
443+
doc"""
444+
Computes the Chebyshev expansion coefficients given the Legendre expansion coefficients:
445+
446+
```math
447+
{\rm CLT} : \sum_{n=0}^N c_n^{\rm leg}P_n(x) \to \sum_{n=0}^N c_n^{\rm cheb}T_n(x).
448+
```
449+
"""
450+
leg2cheb(::Vector)
451+
452+
doc"""
453+
Computes the Legendre expansion coefficients given the Chebyshev expansion coefficients:
454+
455+
```math
456+
{\rm iCLT} : \sum_{n=0}^N c_n^{\rm cheb}T_n(x) \to \sum_{n=0}^N c_n^{\rm leg}P_n(x).
457+
```
458+
"""
459+
cheb2leg(::Vector)
460+
461+
doc"""
462+
Pre-computes the Legendre--Chebyshev transform.
463+
"""
464+
plan_leg2cheb(::Vector)
465+
466+
doc"""
467+
Pre-computes the Chebyshev--Legendre transform.
468+
"""
469+
plan_cheb2leg(::Vector)

0 commit comments

Comments
 (0)