Skip to content

Commit 8c4dcd9

Browse files
committed
region(p) -> fftdims(p)
1 parent b5d3920 commit 8c4dcd9

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To define a new FFT implementation in your own module, you should
2323
inverse plan.
2424

2525
* Define a new method `AbstractFFTs.plan_fft(x, region; kws...)` that returns a `MyPlan` for at least some types of
26-
`x` and some set of dimensions `region`. The `region` (or a copy thereof) should be accessible via `region(p::MyPlan)` (which defaults to `p.region`).
26+
`x` and some set of dimensions `region`. The `region` (or a copy thereof) should be accessible via `fftdims(p::MyPlan)` (which defaults to `p.region`).
2727

2828
* Define a method of `LinearAlgebra.mul!(y, p::MyPlan, x)` (or `A_mul_B!(y, p::MyPlan, x)` on Julia prior to
2929
0.7.0-DEV.3204) that computes the transform `p` of `x` and stores the result in `y`.

docs/src/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AbstractFFTs.brfft
1919
AbstractFFTs.plan_rfft
2020
AbstractFFTs.plan_brfft
2121
AbstractFFTs.plan_irfft
22-
AbstractFFTs.region
22+
AbstractFFTs.fftdims
2323
AbstractFFTs.fftshift
2424
AbstractFFTs.ifftshift
2525
AbstractFFTs.fftfreq

src/AbstractFFTs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ChainRulesCore
55
export fft, ifft, bfft, fft!, ifft!, bfft!,
66
plan_fft, plan_ifft, plan_bfft, plan_fft!, plan_ifft!, plan_bfft!,
77
rfft, irfft, brfft, plan_rfft, plan_irfft, plan_brfft,
8-
fftshift, ifftshift, fftshift!, ifftshift!, Frequencies, fftfreq, rfftfreq
8+
fftdims, fftshift, ifftshift, fftshift!, ifftshift!, Frequencies, fftfreq, rfftfreq
99

1010
include("definitions.jl")
1111
include("chainrules.jl")

src/definitions.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ ndims(p::Plan) = length(size(p))
1616
length(p::Plan) = prod(size(p))::Int
1717

1818
"""
19-
region(p::Plan)
19+
fftdims(p::Plan)
2020
2121
Return an iterable of the dimensions that are transformed by the FFT plan `p`.
2222
2323
# Implementation
2424
25-
The default definition of `region` returns `p.region`.
26-
Hence this method should be implemented only for types of `Plan`s that do not store the transformed region in a field of name `region`.
25+
For legacy reasons, the default definition of `fftdims` returns `p.region`.
26+
Hence this method should be implemented only for `Plan` subtypes that do not store the transformed dimensions in a field named `region`.
2727
"""
28-
region(p::Plan) = p.region
28+
fftdims(p::Plan) = p.region
2929

3030
fftfloat(x) = _fftfloat(float(x))
3131
_fftfloat(::Type{T}) where {T<:BlasReal} = T
@@ -255,7 +255,7 @@ ScaledPlan(p::ScaledPlan, α::Number) = ScaledPlan(p.p, p.scale * α)
255255

256256
size(p::ScaledPlan) = size(p.p)
257257

258-
region(p::ScaledPlan) = region(p.p)
258+
fftdims(p::ScaledPlan) = fftdims(p.p)
259259

260260
show(io::IO, p::ScaledPlan) = print(io, p.scale, " * ", p.p)
261261
summary(p::ScaledPlan) = string(p.scale, " * ", summary(p.p))

test/runtests.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,21 @@ end
6060
@test eltype(P) === ComplexF64
6161
@test P * x fftw_fft
6262
@test P \ (P * x) x
63-
@test AbstractFFTs.region(P) == dims
63+
@test fftdims(P) == dims
6464

6565
fftw_bfft = complex.(size(x, dims) .* x)
6666
@test AbstractFFTs.bfft(y, dims) fftw_bfft
6767
P = plan_bfft(x, dims)
6868
@test P * y fftw_bfft
6969
@test P \ (P * y) y
70-
@test AbstractFFTs.region(P) == dims
70+
@test fftdims(P) == dims
7171

7272
fftw_ifft = complex.(x)
7373
@test AbstractFFTs.ifft(y, dims) fftw_ifft
7474
P = plan_ifft(x, dims)
7575
@test P * y fftw_ifft
7676
@test P \ (P * y) y
77-
@test AbstractFFTs.region(P) == dims
77+
@test fftdims(P) == dims
7878

7979
# real FFT
8080
fftw_rfft = fftw_fft[
@@ -87,21 +87,21 @@ end
8787
@test eltype(P) === Int
8888
@test P * x fftw_rfft
8989
@test P \ (P * x) x
90-
@test AbstractFFTs.region(P) == dims
90+
@test fftdims(P) == dims
9191

9292
fftw_brfft = complex.(size(x, dims) .* x)
9393
@test AbstractFFTs.brfft(ry, size(x, dims), dims) fftw_brfft
9494
P = plan_brfft(ry, size(x, dims), dims)
9595
@test P * ry fftw_brfft
9696
@test P \ (P * ry) ry
97-
@test AbstractFFTs.region(P) == dims
98-
97+
@test fftdims(P) == dims
98+
9999
fftw_irfft = complex.(x)
100100
@test AbstractFFTs.irfft(ry, size(x, dims), dims) fftw_irfft
101101
P = plan_irfft(ry, size(x, dims), dims)
102102
@test P * ry fftw_irfft
103103
@test P \ (P * ry) ry
104-
@test AbstractFFTs.region(P) == dims
104+
@test fftdims(P) == dims
105105
end
106106
end
107107

@@ -193,7 +193,7 @@ end
193193
# normalization should be inferable even if region is only inferred as ::Any,
194194
# need to wrap in another function to test this (note that p.region::Any for
195195
# p::TestPlan)
196-
f9(p::Plan{T}, sz) where {T} = AbstractFFTs.normalization(real(T), sz, AbstractFFTs.region(p))
196+
f9(p::Plan{T}, sz) where {T} = AbstractFFTs.normalization(real(T), sz, fftdims(p))
197197
@test @inferred(f9(plan_fft(zeros(10), 1), 10)) == 1/10
198198
end
199199

0 commit comments

Comments
 (0)