Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
287 changes: 197 additions & 90 deletions src/plan.jl

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions test/argument_checking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,22 @@ end
@test_throws DomainError size(p_r, -1)
end
end

@testset "Invalid / mutated dims" verbose=true begin
@testset "Extra elements" begin
for n in 3:5
x = rand(ComplexF64, ntuple(i -> 2, n))
p1 = plan_fft(x, [1:n-1;])
push!(p1.region, n)
@test_throws DimensionMismatch("Region is invalid.") p1 * x
end
end
@testset "Unsorted dims" begin
for n in 3:5
x = rand(ComplexF64, ntuple(i -> 2, n))
p2 = plan_fft(x, [1:n-1;])
p2.region[1:2] = [2, 1]
@test_throws DimensionMismatch("Region is invalid.") p2 * x
end
end
end
4 changes: 2 additions & 2 deletions test/ndim/minimal_complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ using FFTA, Test

@testset "Basic ND checks" begin
for sz in ((3, 5, 7), (4, 14, 9), (103, 5, 13), (26, 33, 35, 4), ntuple(i -> 3, 5))
x = ones(sz)
@test fft(x) ≈ setindex!(zeros(sz), prod(sz), 1)
x = ones(ComplexF64, sz)
@test fft(x, Tuple(1:ndims(x))) ≈ setindex!(zeros(sz), prod(sz), 1)
end

y = zeros((3, 3, 3))
Expand Down
5 changes: 4 additions & 1 deletion test/qa/explicit_imports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import ExplicitImports
# No non-public accesses in FFTA (ie. no `... MyPkg._non_public_internal_func(...)`)
# AbstractFFTs requires subtyping of `Plan` but it is not public
# This is an upstream bug in AbstractFFTs.jl
@test ExplicitImports.check_all_qualified_accesses_are_public(FFTA; ignore = (:Plan, :require_one_based_indexing, :Fix1, :Cartesian)) === nothing
@test ExplicitImports.check_all_qualified_accesses_are_public(
FFTA;
ignore=(:Plan, :require_one_based_indexing, :Fix1, :Cartesian, :peel)
) === nothing

# No self-qualified accesses in FFTA (ie. no `... FFTA.func(...)`)
@test ExplicitImports.check_no_self_qualified_accesses(FFTA) === nothing
Expand Down
16 changes: 12 additions & 4 deletions test/twodim/complex_backward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ end
end
end

@testset "2D plan, ND array. Size: $n" for n in 1:64
x = randn(ComplexF64, n, n + 1, n + 2)
@testset "$(N)D plan, $(N+1)D array" for N in 2:3
rg = N == 2 ? (1:64) : (1:16)
dims_lst = [[1,2], [1,3], [2,3]]
if N == 3
foreach(v -> push!(v, 4), dims_lst)
end
@testset "against $(N)D arrays with mapslices, r=$r" for r in dims_lst
for n in rg
x = randn(ComplexF64, ntuple(i -> n + (i - 1), N + 1))

@testset "against 1D array with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
@test bfft(x, r) == mapslices(bfft, x; dims = r)
t = Tuple(r) # test tuple region argument
@test bfft(x, t) == bfft(x, r) == mapslices(bfft, x; dims = r)
end
end
end

Expand Down
16 changes: 12 additions & 4 deletions test/twodim/complex_forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,19 @@ end
end
end

@testset "2D plan, ND array. Size: $n" for n in 1:64
x = randn(ComplexF64, n, n + 1, n + 2)
@testset "$(N)D plan, $(N+1)D array" for N in 2:3
rg = N == 2 ? (1:64) : (1:16)
dims_lst = [[1,2], [1,3], [2,3]]
if N == 3
foreach(v -> push!(v, 4), dims_lst)
end
@testset "against $(N)D arrays with mapslices, r=$r" for r in dims_lst
for n in rg
x = randn(ComplexF64, ntuple(i -> n + (i - 1), N + 1))

@testset "against 1D array with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
@test fft(x, r) == mapslices(fft, x; dims = r)
t = Tuple(r) # test tuple region argument
@test fft(x, t) == fft(x, r) == mapslices(fft, x; dims = r)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/twodim/real_backward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
@test x ≈ irfft(rfft(x,r), size(x,r[1]), r)
end

@testset "against 2D array with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
@testset "against 2D arrays with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
y = rfft(x, r)
@test brfft(y, size(x, r[1]), r) == mapslices(t -> brfft(t, size(x, r[1])), y; dims = r)
end
Expand Down
2 changes: 1 addition & 1 deletion test/twodim/real_forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ end
@testset "2D plan, ND array. Size: $n" for n in 1:64
x = randn(n, n + 1, n + 2)

@testset "against 1D array with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
@testset "against 2D arrays with mapslices, r=$r" for r in [[1,2], [1,3], [2,3]]
@test rfft(x, r) == mapslices(rfft, x; dims = r)
end
end
Expand Down
Loading