Skip to content

Commit 3ed3fe0

Browse files
Merge branch 'master' into add-nufft
# Conflicts: # src/FastTransforms.jl # test/runtests.jl
2 parents 5d85f76 + 66bc345 commit 3ed3fe0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2863
-1020
lines changed

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
*.jl.cov
2-
*.jl.*.cov
3-
*.jl.mem
4-
site
1+
docs/build/
2+
docs/site/

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 0.4
87
- 0.5
8+
- 0.6
99
- nightly
10+
matrix:
11+
allow_failures:
12+
- julia: nightly
1013
notifications:
1114
email: false
15+
after_success:
16+
- julia -e 'cd(Pkg.dir("FastTransforms")); Pkg.add("Documenter"); include(joinpath("docs", "make.jl")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
1217
# uncomment the following lines to override the default test script
1318
#script:
1419
# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The FastTransforms.jl package is licensed under the MIT "Expat" License:
22

3-
> Copyright (c) 2016: Richard Mikael Slevinsky.
3+
> Copyright (c) 2017: Richard Mikael Slevinsky.
44
>
55
> Permission is hereby granted, free of charge, to any person obtaining
66
> a copy of this software and associated documentation files (the

README.md

Lines changed: 97 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,57 @@
11
# FastTransforms.jl
22

3-
[![Build Status](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl.svg?branch=master)](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl) [![Documentation Status](https://readthedocs.org/projects/fasttransformsjl/badge/?version=latest)](http://fasttransformsjl.readthedocs.org/en/latest/?badge=latest)
3+
[![Travis](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl.svg?branch=master)](https://travis-ci.org/MikaelSlevinsky/FastTransforms.jl) [![AppVeyor](https://ci.appveyor.com/api/projects/status/oba9qush15q3x8pb/branch/master?svg=true)](https://ci.appveyor.com/project/MikaelSlevinsky/fasttransforms-jl/branch/master) [![codecov](https://codecov.io/gh/MikaelSlevinsky/FastTransforms.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/MikaelSlevinsky/FastTransforms.jl) [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://MikaelSlevinsky.github.io/FastTransforms.jl/stable) [![](https://img.shields.io/badge/docs-latest-blue.svg)](https://MikaelSlevinsky.github.io/FastTransforms.jl/latest)
44

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.
5+
The aim of this package is to provide fast orthogonal polynomial transforms that are designed for expansions of functions with any degree of regularity. There are multiple approaches to the classical connection problem, though the user does not need to know the specifics.
6+
7+
One approach is based on the use of asymptotic formulae to relate the transforms to a small number of fast Fourier transforms. Another approach is based on a Toeplitz-dot-Hankel decomposition of the matrix of connection coefficients. Alternatively, the matrix of connection coefficients may be decomposed hierarchically à la Fast Multipole Method.
8+
9+
## The Chebyshev—Legendre Transform
10+
11+
The Chebyshev—Legendre transform allows the fast conversion of Chebyshev expansion coefficients to Legendre expansion coefficients and back.
1012

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.
1413
```julia
1514
julia> Pkg.add("FastTransforms")
1615

1716
julia> using FastTransforms
1817

1918
julia> c = rand(10001);
2019

20+
julia> leg2cheb(c);
21+
22+
julia> cheb2leg(c);
23+
24+
julia> norm(cheb2leg(leg2cheb(c))-c)
25+
5.564168202018823e-13
26+
```
27+
28+
The implementation separates pre-computation into a type of plan. This type is constructed with either `plan_leg2cheb` or `plan_cheb2leg`. Let's see how much faster it is if we pre-compute.
29+
30+
```julia
31+
julia> p1 = plan_leg2cheb(c);
32+
33+
julia> p2 = plan_cheb2leg(c);
34+
35+
julia> @time leg2cheb(c);
36+
0.082615 seconds (11.94 k allocations: 31.214 MiB, 6.75% gc time)
37+
38+
julia> @time p1*c;
39+
0.004297 seconds (6 allocations: 78.422 KiB)
40+
41+
julia> @time cheb2leg(c);
42+
0.110388 seconds (11.94 k allocations: 31.214 MiB, 8.16% gc time)
43+
44+
julia> @time p2*c;
45+
0.004500 seconds (6 allocations: 78.422 KiB)
46+
```
47+
48+
## The Chebyshev—Jacobi Transform
49+
50+
The Chebyshev—Jacobi transform allows the fast conversion of Chebyshev expansion coefficients to Jacobi expansion coefficients and back.
51+
52+
```julia
53+
julia> c = rand(10001);
54+
2155
julia> @time norm(icjt(cjt(c,0.1,-0.2),0.1,-0.2)-c,Inf)
2256
0.258390 seconds (431 allocations: 6.278 MB)
2357
1.4830359162942841e-12
@@ -41,10 +75,61 @@ is valid for the half-open square `(α,β) ∈ (-1/2,1/2]^2`. Therefore, the fas
4175
when the parameters are inside. If the parameters `(α,β)` are not exceptionally beyond the square,
4276
then increment/decrement operators are used with linear complexity (and linear conditioning) in the degree.
4377

78+
## The Padua Transform
79+
80+
The Padua transform and its inverse are implemented thanks to [Michael Clarke](https://github.com/MikeAClarke). These are optimized methods designed for computing the bivariate Chebyshev coefficients by interpolating a bivariate function at the Padua points on `[-1,1]^2`.
81+
82+
```julia
83+
julia> n = 200;
84+
85+
julia> N = div((n+1)*(n+2),2);
86+
87+
julia> v = rand(N); # The length of v is the number of Padua points
88+
89+
julia> @time norm(ipaduatransform(paduatransform(v))-v)
90+
0.006571 seconds (846 allocations: 1.746 MiB)
91+
3.123637691861415e-14
92+
93+
```
94+
95+
## The Spherical Harmonic Transform
96+
97+
Let `F` be a matrix of spherical harmonic expansion coefficients arranged by increasing order in absolute value, alternating between negative and positive orders. Then `sph2fourier` converts the representation into a bivariate Fourier series, and `fourier2sph` converts it back.
98+
```julia
99+
julia> F = sphrandn(Float64, 256, 256);
100+
101+
julia> G = sph2fourier(F);
102+
103+
julia> H = fourier2sph(G);
104+
105+
julia> norm(F-H)
106+
4.950645831278297e-14
107+
108+
julia> F = sphrandn(Float64, 1024, 1024);
109+
110+
julia> G = sph2fourier(F; sketch = :none);
111+
Pre-computing...100%|███████████████████████████████████████████| Time: 0:00:04
112+
113+
julia> H = fourier2sph(G; sketch = :none);
114+
Pre-computing...100%|███████████████████████████████████████████| Time: 0:00:04
115+
116+
julia> norm(F-H)
117+
1.1510623098225283e-12
118+
119+
```
120+
121+
As with other fast transforms, `plan_sph2fourier` saves effort by caching the pre-computation. Be warned that for dimensions larger than `1,000`, this is no small feat!
122+
44123
# References:
45124

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.
125+
[1] B. Alpert and V. Rokhlin. <a href="http://dx.doi.org/10.1137/0912009">A fast algorithm for the evaluation of Legendre expansions</a>, *SIAM J. Sci. Stat. Comput.*, **12**:158—179, 1991.
126+
127+
[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.
128+
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.
130+
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.
47132

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.
133+
[5] R. M. Slevinsky. <a href="https://arxiv.org/abs/1705.05448">Fast and backward stable transforms between spherical harmonic expansions and bivariate Fourier series</a>, arXiv:1705.05448, 2017.
49134

50-
3. 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.
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.

REQUIRE

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
julia 0.4
2-
ToeplitzMatrices 0.1
3-
Compat 0.8.4
1+
julia 0.5
2+
ToeplitzMatrices 0.2
3+
HierarchicalMatrices 0.0.2
4+
LowRankApprox 0.0.2
5+
ProgressMeter 0.3.4
6+
Compat 0.17

appveyor.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
environment:
22
matrix:
3-
- JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
4-
- JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
5-
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
6-
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.5/julia-0.5-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.5/julia-0.5-latest-win64.exe"
5+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
6+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
7+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
8+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
9+
10+
matrix:
11+
allow_failures:
12+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
13+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
714

815
branches:
916
only:
@@ -17,9 +24,15 @@ notifications:
1724
on_build_status_changed: false
1825

1926
install:
27+
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
28+
# If there's a newer build queued for the same PR, cancel this one
29+
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
30+
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
31+
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
32+
throw "There are newer queued builds for this pull request, failing early." }
2033
# Download most recent Julia Windows binary
2134
- ps: (new-object net.webclient).DownloadFile(
22-
$("http://s3.amazonaws.com/"+$env:JULIAVERSION),
35+
$env:JULIA_URL,
2336
"C:\projects\julia-binary.exe")
2437
# Run installer silently, output to C:\projects\julia
2538
- C:\projects\julia-binary.exe /S /D=C:\projects\julia

builddocs

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)