Skip to content

Commit 2a2d685

Browse files
committed
Merge remote-tracking branch 'origin/master' into adjoint
2 parents 25bb86b + 0918c3c commit 2a2d685

File tree

3 files changed

+85
-18
lines changed

3 files changed

+85
-18
lines changed

.github/workflows/IntegrationTest.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: IntegrationTest
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
tags: '*'
9+
10+
jobs:
11+
test:
12+
name: ${{ matrix.package.repo }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
julia-version: [1]
18+
os: [ubuntu-latest]
19+
package:
20+
- {user: JuliaMath, repo: FFTW.jl}
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: julia-actions/setup-julia@v1
24+
with:
25+
version: ${{ matrix.julia-version }}
26+
arch: x64
27+
- uses: julia-actions/julia-buildpkg@latest
28+
- name: Clone Downstream
29+
uses: actions/checkout@v2
30+
with:
31+
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
32+
path: downstream
33+
- name: Load this and run the downstream tests
34+
shell: julia --project=downstream {0}
35+
run: |
36+
using Pkg
37+
try
38+
# force it to use this PR's version of the package
39+
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
40+
Pkg.update()
41+
Pkg.test() # resolver may fail with test time deps
42+
catch err
43+
err isa Pkg.Resolve.ResolverError || rethrow()
44+
# If we can't resolve that means this is incompatible by SemVer and this is fine
45+
# It means we marked this as a breaking change, so we don't need to worry about
46+
# Mistakenly introducing a breaking change, as we have intentionally made one
47+
@info "Not compatible with this release. No problem." exception=err
48+
exit(0) # Exit immediately, as a success
49+
end

src/definitions.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ plan_ifft(x::AbstractArray, region; kws...) =
281281
plan_ifft!(x::AbstractArray, region; kws...) =
282282
ScaledPlan(plan_bfft!(x, region; kws...), normalization(x, region))
283283

284+
plan_inv(p::ScaledPlan) = ScaledPlan(plan_inv(p.p), inv(p.scale))
285+
# Don't cache inverse of scaled plan (only inverse of inner plan)
284286
inv(p::ScaledPlan) = ScaledPlan(inv(p.p), inv(p.scale))
285287

286288
LinearAlgebra.mul!(y::AbstractArray, p::ScaledPlan, x::AbstractArray) =

test/runtests.jl

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ end
5858
dims = ndims(x)
5959
y = AbstractFFTs.fft(x, dims)
6060
@test y fftw_fft
61-
P = plan_fft(x, dims)
62-
@test eltype(P) === ComplexF64
63-
@test P * x fftw_fft
64-
@test P \ (P * x) x
65-
@test fftdims(P) == dims
61+
# test plan_fft and also inv and plan_inv of plan_ifft, which should all give
62+
# functionally identical plans
63+
for P in [plan_fft(x, dims), inv(plan_ifft(x, dims)),
64+
AbstractFFTs.plan_inv(plan_ifft(x, dims))]
65+
@test eltype(P) === ComplexF64
66+
@test P * x fftw_fft
67+
@test P \ (P * x) x
68+
@test fftdims(P) == dims
69+
end
6670

6771
fftw_bfft = complex.(size(x, dims) .* x)
6872
@test AbstractFFTs.bfft(y, dims) fftw_bfft
@@ -73,10 +77,14 @@ end
7377

7478
fftw_ifft = complex.(x)
7579
@test AbstractFFTs.ifft(y, dims) fftw_ifft
76-
P = plan_ifft(x, dims)
77-
@test P * y fftw_ifft
78-
@test P \ (P * y) y
79-
@test fftdims(P) == dims
80+
# test plan_ifft and also inv and plan_inv of plan_fft, which should all give
81+
# functionally identical plans
82+
for P in [plan_ifft(x, dims), inv(plan_fft(x, dims)),
83+
AbstractFFTs.plan_inv(plan_fft(x, dims))]
84+
@test P * y fftw_ifft
85+
@test P \ (P * y) y
86+
@test fftdims(P) == dims
87+
end
8088

8189
# real FFT
8290
fftw_rfft = fftw_fft[
@@ -85,11 +93,15 @@ end
8593
]
8694
ry = AbstractFFTs.rfft(x, dims)
8795
@test ry fftw_rfft
88-
P = plan_rfft(x, dims)
89-
@test eltype(P) === Int
90-
@test P * x fftw_rfft
91-
@test P \ (P * x) x
92-
@test fftdims(P) == dims
96+
# test plan_rfft and also inv and plan_inv of plan_irfft, which should all give
97+
# functionally identical plans
98+
for P in [plan_rfft(x, dims), inv(plan_irfft(ry, size(x, dims), dims)),
99+
AbstractFFTs.plan_inv(plan_irfft(ry, size(x, dims), dims))]
100+
@test eltype(P) <: Real
101+
@test P * x fftw_rfft
102+
@test P \ (P * x) x
103+
@test fftdims(P) == dims
104+
end
93105

94106
fftw_brfft = complex.(size(x, dims) .* x)
95107
@test AbstractFFTs.brfft(ry, size(x, dims), dims) fftw_brfft
@@ -100,10 +112,14 @@ end
100112

101113
fftw_irfft = complex.(x)
102114
@test AbstractFFTs.irfft(ry, size(x, dims), dims) fftw_irfft
103-
P = plan_irfft(ry, size(x, dims), dims)
104-
@test P * ry fftw_irfft
105-
@test P \ (P * ry) ry
106-
@test fftdims(P) == dims
115+
# test plan_rfft and also inv and plan_inv of plan_irfft, which should all give
116+
# functionally identical plans
117+
for P in [plan_irfft(ry, size(x, dims), dims), inv(plan_rfft(x, dims)),
118+
AbstractFFTs.plan_inv(plan_rfft(x, dims))]
119+
@test P * ry fftw_irfft
120+
@test P \ (P * ry) ry
121+
@test fftdims(P) == dims
122+
end
107123
end
108124
end
109125

0 commit comments

Comments
 (0)