Skip to content

Commit 314b203

Browse files
add docs
1 parent b1dce33 commit 314b203

File tree

12 files changed

+378
-45
lines changed

12 files changed

+378
-45
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.jl.cov
22
*.jl.*.cov
33
*.jl.mem
4+
site

builddocs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cd docs
2+
julia build.jl
3+
cd ..
4+
mkdocs build --clean
5+
(sleep 1 && open -a Safari http://127.0.0.1:8000)& # waits for mkdoc server to start up
6+
mkdocs serve

docs/api/FastTransforms.md

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# FastTransforms
2+
3+
## Exported
4+
5+
---
6+
7+
<a id="method__cjt.1" class="lexicon_definition"></a>
8+
#### cjt(c, α, β) [](#method__cjt.1)
9+
Computes the Chebyshev expansion coefficients
10+
given the Jacobi expansion coefficients ``c`` with parameters ``α`` and ``β``.
11+
12+
See also [`icjt`](#method__icjt.1) and [`jjt`](#method__jjt.1).
13+
14+
15+
*source:*
16+
[FastTransforms/src/cjt.jl:127](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/cjt.jl#L127)
17+
18+
---
19+
20+
<a id="method__gaunt.1" class="lexicon_definition"></a>
21+
#### gaunt(m::Int64, n::Int64, μ::Int64, ν::Int64) [](#method__gaunt.1)
22+
Calculates the Gaunt coefficients in 64-bit floating-point arithmetic.
23+
24+
25+
*source:*
26+
[FastTransforms/src/gaunt.jl:24](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/gaunt.jl#L24)
27+
28+
---
29+
30+
<a id="method__gaunt.2" class="lexicon_definition"></a>
31+
#### gaunt{T}(::Type{T}, m::Int64, n::Int64, μ::Int64, ν::Int64) [](#method__gaunt.2)
32+
Calculates the Gaunt coefficients, defined by:
33+
34+
a(m,n,μ,ν,q) = (2(n+ν-2q)+1)/2 (n+ν-2q-m-μ)!/(n+ν-2q+m+μ)! ∫₋₁⁺¹ P_m^n(x) P_ν^μ(x) P_{n+ν-2q}^{m+μ}(x) dx.
35+
36+
or defined by:
37+
38+
P_n^m(x) P_ν^μ(x) = ∑_{q=0}^{q_{max}} a(m,n,μ,ν,q) P_{n+ν-2q}^{m+μ}(x)
39+
40+
This is a Julia implementation of the stable recurrence described in:
41+
42+
Y.-l. Xu, "Fast evaluation of Gaunt coefficients: recursive approach", J. Comp. Appl. Math., 85:53–65, 1997.
43+
44+
45+
*source:*
46+
[FastTransforms/src/gaunt.jl:14](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/gaunt.jl#L14)
47+
48+
---
49+
50+
<a id="method__icjt.1" class="lexicon_definition"></a>
51+
#### icjt(c, α, β) [](#method__icjt.1)
52+
Computes the Jacobi expansion coefficients with parameters ``α`` and ``β``
53+
given the Chebyshev expansion coefficients ``c``.
54+
55+
See also [`cjt`](#method__cjt.1) and [`jjt`](#method__jjt.1).
56+
57+
58+
*source:*
59+
[FastTransforms/src/cjt.jl:135](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/cjt.jl#L135)
60+
61+
---
62+
63+
<a id="method__jjt.1" class="lexicon_definition"></a>
64+
#### jjt(c, α, β, γ, δ) [](#method__jjt.1)
65+
Computes the Jacobi expansion coefficients with parameters ``γ`` and ``δ``
66+
given the Jacobi expansion coefficients ``c`` with parameters ``α`` and ``β``.
67+
68+
See also [`cjt`](#method__cjt.1) and [`icjt`](#method__icjt.1).
69+
70+
71+
*source:*
72+
[FastTransforms/src/cjt.jl:143](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/cjt.jl#L143)
73+
74+
---
75+
76+
<a id="method__plan_cjt.1" class="lexicon_definition"></a>
77+
#### plan_cjt(c::AbstractArray{T, 1}, α, β) [](#method__plan_cjt.1)
78+
Pre-plan optimized DCT-I and DST-I plans and pre-allocate the necessary
79+
arrays, normalization constants, and recurrence coefficients for a forward Chebyshev—Jacobi transform.
80+
81+
``c`` is the vector of coefficients; and,
82+
83+
``α`` and ``β`` are the Jacobi parameters.
84+
85+
Optionally:
86+
87+
``M`` determines the number of terms in Hahn's asymptotic expansion.
88+
89+
90+
*source:*
91+
[FastTransforms/src/cjt.jl:157](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/cjt.jl#L157)
92+
93+
---
94+
95+
<a id="method__plan_icjt.1" class="lexicon_definition"></a>
96+
#### plan_icjt(c::AbstractArray{T, 1}, α, β) [](#method__plan_icjt.1)
97+
Pre-plan optimized DCT-I and DST-I plans and pre-allocate the necessary
98+
arrays, normalization constants, and recurrence coefficients for an inverse Chebyshev—Jacobi transform.
99+
100+
``c`` is the vector of coefficients; and,
101+
102+
``α`` and ``β`` are the Jacobi parameters.
103+
104+
Optionally:
105+
106+
``M`` determines the number of terms in Hahn's asymptotic expansion.
107+
108+
109+
*source:*
110+
[FastTransforms/src/cjt.jl:176](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/cjt.jl#L176)
111+
112+
## Internal
113+
114+
---
115+
116+
<a id="method__chebyshevjacobimoments1.1" class="lexicon_definition"></a>
117+
#### chebyshevjacobimoments1{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__chebyshevjacobimoments1.1)
118+
Modified Chebyshev moments of the first kind with respect to the Jacobi weight:
119+
120+
∫₋₁⁺¹ T_n(x) (1-x)^α(1+x)^β dx.
121+
122+
123+
124+
*source:*
125+
[FastTransforms/src/specialfunctions.jl:362](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/specialfunctions.jl#L362)
126+
127+
---
128+
129+
<a id="method__chebyshevjacobimoments2.1" class="lexicon_definition"></a>
130+
#### chebyshevjacobimoments2{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__chebyshevjacobimoments2.1)
131+
Modified Chebyshev moments of the second kind with respect to the Jacobi weight:
132+
133+
∫₋₁⁺¹ U_n(x) (1-x)^α(1+x)^β dx.
134+
135+
136+
137+
*source:*
138+
[FastTransforms/src/specialfunctions.jl:380](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/specialfunctions.jl#L380)
139+
140+
---
141+
142+
<a id="method__clenshawcurtisweights.1" class="lexicon_definition"></a>
143+
#### clenshawcurtisweights{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__clenshawcurtisweights.1)
144+
Compute weights of the Clenshaw—Curtis quadrature rule with a Jacobi weight.
145+
146+
147+
*source:*
148+
[FastTransforms/src/clenshawcurtis.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/clenshawcurtis.jl#L12)
149+
150+
---
151+
152+
<a id="method__clenshawcurtis.1" class="lexicon_definition"></a>
153+
#### clenshawcurtis{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__clenshawcurtis.1)
154+
Compute nodes and weights of the Clenshaw—Curtis quadrature rule with a Jacobi weight.
155+
156+
157+
*source:*
158+
[FastTransforms/src/clenshawcurtis.jl:6](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/clenshawcurtis.jl#L6)
159+
160+
---
161+
162+
<a id="method__fejer1.1" class="lexicon_definition"></a>
163+
#### fejer1{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__fejer1.1)
164+
Compute nodes and weights of Fejer's first quadrature rule with a Jacobi weight.
165+
166+
167+
*source:*
168+
[FastTransforms/src/fejer.jl:7](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/fejer.jl#L7)
169+
170+
---
171+
172+
<a id="method__fejer2.1" class="lexicon_definition"></a>
173+
#### fejer2{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__fejer2.1)
174+
Compute nodes and weights of Fejer's second quadrature rule with a Jacobi weight.
175+
176+
177+
*source:*
178+
[FastTransforms/src/fejer.jl:12](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/fejer.jl#L12)
179+
180+
---
181+
182+
<a id="method__fejerweights1.1" class="lexicon_definition"></a>
183+
#### fejerweights1{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__fejerweights1.1)
184+
Compute weights of Fejer's first quadrature rule with a Jacobi weight.
185+
186+
187+
*source:*
188+
[FastTransforms/src/fejer.jl:21](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/fejer.jl#L21)
189+
190+
---
191+
192+
<a id="method__fejerweights2.1" class="lexicon_definition"></a>
193+
#### fejerweights2{T<:AbstractFloat}(N::Int64, α::T<:AbstractFloat, β::T<:AbstractFloat) [](#method__fejerweights2.1)
194+
Compute weights of Fejer's second quadrature rule with a Jacobi weight.
195+
196+
197+
*source:*
198+
[FastTransforms/src/fejer.jl:26](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/fejer.jl#L26)
199+
200+
---
201+
202+
<a id="method__pochhammer.1" class="lexicon_definition"></a>
203+
#### pochhammer(x::Number, n::Integer) [](#method__pochhammer.1)
204+
Pochhammer symbol (x)_n = Γ(x+n)/Γ(x) for the rising factorial.
205+
206+
207+
*source:*
208+
[FastTransforms/src/specialfunctions.jl:13](https://github.com/MikaelSlevinsky/FastTransforms.jl/tree/b1dce339ed19119766d44b5ec44d954932da58d3/src/specialfunctions.jl#L13)
209+

docs/api/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Files in this directory are generated using the `build.jl` script. Make
2+
all changes to the originating docstrings/files rather than these ones.
3+
Documentation should *only* be built directly on the `master` branch.
4+
Source links would otherwise become unavailable should a branch be
5+
deleted from the `origin`. This means potential pull request authors
6+
*should not* run the build script when filing a PR.

docs/build.jl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Adapted from https://github.com/MichaelHatherly/Docile.jl
2+
# (C) Michael Hatherly, under MIT-license
3+
using Lexicon, FastTransforms
4+
5+
const api_directory = "api"
6+
const modules = [FastTransforms]
7+
8+
cd(dirname(@__FILE__)) do
9+
10+
# Run the doctests *before* we start to generate *any* documentation.
11+
for m in modules
12+
failures = failed(doctest(m))
13+
if !isempty(failures.results)
14+
println("\nDoctests failed, aborting commit.\n")
15+
display(failures)
16+
exit(1) # Bail when doctests fail.
17+
end
18+
end
19+
# also execute examples
20+
#include("../examples/ex1.jl")
21+
22+
# Generate and save the contents of docstrings as markdown files.
23+
index = Index()
24+
for mod in modules
25+
update!(index, save(joinpath(api_directory, "$(mod).md"), mod))
26+
end
27+
#save(joinpath(api_directory, "index.md"), index; md_subheader = :category)
28+
29+
# Add a reminder not to edit the generated files.
30+
open(joinpath(api_directory, "README.md"), "w") do f
31+
print(f, """
32+
Files in this directory are generated using the `build.jl` script. Make
33+
all changes to the originating docstrings/files rather than these ones.
34+
Documentation should *only* be built directly on the `master` branch.
35+
Source links would otherwise become unavailable should a branch be
36+
deleted from the `origin`. This means potential pull request authors
37+
*should not* run the build script when filing a PR.
38+
""")
39+
end
40+
41+
#info("Adding all documentation changes in $(api_directory) to this commit.")
42+
#success(`git add $(api_directory)`) || exit(1)
43+
end

docs/index.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# FastTransforms.jl
2+
3+
[![Build Status](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl.svg?branch=master)](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl)
4+
5+
The aim of this package is to provide a new class of fast transforms
6+
based on the use of asymptotic formulae to relate the transforms to a small
7+
number of fast Fourier transforms. This new class of fast transforms does not
8+
require large pre-computation for fast execution, and they are designed
9+
to work on expansions of functions with any degree of regularity.
10+
11+
The Chebyshev—Jacobi transform and its inverse are implemented. This
12+
allows the fast conversion of Chebyshev expansion coefficients to Jacobi expansion
13+
coefficients and back.
14+
```julia
15+
julia> Pkg.add("FastTransforms")
16+
17+
julia> using FastTransforms
18+
19+
julia> c = rand(10001);
20+
21+
julia> @time norm(icjt(cjt(c,0.1,-0.2),0.1,-0.2)-c,Inf)
22+
0.435853 seconds (507 allocations: 5.366 MB)
23+
1.4830359162942841e-12
24+
25+
julia> p1 = plan_cjt(c,0.1,-0.2);
26+
27+
julia> p2 = plan_icjt(c,0.1,-0.2);
28+
29+
julia> @time norm(p2*(p1*c)-c,Inf)
30+
0.396803 seconds (101 allocations: 473.281 KB)
31+
1.4830359162942841e-12
32+
33+
```
34+
35+
The design and implementation is analogous to FFTW: there is a type `ChebyshevJacobiPlan`
36+
that stores pre-planned optimized DCT-I and DST-I plans, recurrence coefficients,
37+
and temporary arrays to allow the execution of either the `cjt` or the `icjt` allocation-free.
38+
This type is constructed with either `plan_cjt` or `plan_icjt`. Composition of transforms
39+
allows the Jacobi—Jacobi transform, computed via `jjt`. The remainder in Hahn's asymptotic expansion
40+
is valid for the half-open square `(α,β) ∈ (-1/2,1/2]^2`. Therefore, the fast transform works best
41+
when the parameters are inside. If the parameters `(α,β)` are not exceptionally beyond the square,
42+
then increment/decrement operators are used with linear complexity (and linear conditioning) in the degree.
43+
44+
# References:
45+
46+
1. 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.
47+
48+
2. R. M. Slevinsky. <a href="http://arxiv.org/abs/1602.02618">On the use of Hahn's asymptotic formula and stabilized recurrence for a fast, simple, and stable Chebyshev—Jacobi transform</a>, arXiv:1602.02618, 2016.

mkdocs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
site_name: FastTransforms.jl
2+
repo_url: https://github.com/MikaelSlevinsky/FastTransforms.jl
3+
site_description: Julia package for a new class of fast transforms based on asymptotic formulae
4+
site_author: Richard Mikael Slevinsky
5+
theme: readthedocs
6+
markdown_extensions: [tables, fenced_code]
7+
pages:
8+
- Introduction: index.md
9+
- API: api/FastTransforms.md

0 commit comments

Comments
 (0)