Skip to content

Commit 99ad9ad

Browse files
Close #95
1 parent f83cd2e commit 99ad9ad

File tree

2 files changed

+95
-113
lines changed

2 files changed

+95
-113
lines changed

test/libfasttransformstests.jl

Lines changed: 92 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,43 @@ FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))
55
@testset "libfasttransforms" begin
66
n = 64
77
α, β, γ, δ, λ, μ = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6
8+
function test_1d_plans(p1, p2, x; skip::Bool=false)
9+
y = p1*x
10+
z = p2*y
11+
@test z x
12+
y = p1*x
13+
z = p1'y
14+
y = transpose(p1)*z
15+
z = transpose(p1)\y
16+
y = p1'\z
17+
z = p1\y
18+
@test z x
19+
y = p2*x
20+
z = p2'y
21+
y = transpose(p2)*z
22+
z = transpose(p2)\y
23+
y = p2'\z
24+
z = p2\y
25+
@test z x
26+
P = p1*I
27+
Q = p2*P
28+
skip ? (@test_skip Q I) : (@test Q I)
29+
P = p1*I
30+
Q = p1'P
31+
P = transpose(p1)*Q
32+
Q = transpose(p1)\P
33+
P = p1'\Q
34+
Q = p1\P
35+
skip ? (@test_skip Q I) : (@test Q I)
36+
P = p2*I
37+
Q = p2'P
38+
P = transpose(p2)*Q
39+
Q = transpose(p2)\P
40+
P = p2'\Q
41+
Q = p2\P
42+
skip ? (@test_skip Q I) : (@test Q I)
43+
end
44+
845
for T in (Float32, Float64, Complex{Float32}, Complex{Float64})
946
x = T(1)./(1:n)
1047
Id = Matrix{T}(I, n, n)
@@ -15,40 +52,7 @@ FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))
1552
(plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
1653
(plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
1754
(plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
18-
y = p1*x
19-
z = p2*y
20-
@test z x
21-
y = p1*x
22-
z = p1'y
23-
y = transpose(p1)*z
24-
z = transpose(p1)\y
25-
y = p1'\z
26-
z = p1\y
27-
@test z x
28-
y = p2*x
29-
z = p2'y
30-
y = transpose(p2)*z
31-
z = transpose(p2)\y
32-
y = p2'\z
33-
z = p2\y
34-
@test z x
35-
P = p1*I
36-
Q = p2*P
37-
@test Q I
38-
P = p1*I
39-
Q = p1'P
40-
P = transpose(p1)*Q
41-
Q = transpose(p1)\P
42-
P = p1'\Q
43-
Q = p1\P
44-
@test Q I
45-
P = p2*I
46-
Q = p2'P
47-
P = transpose(p2)*Q
48-
Q = transpose(p2)\P
49-
P = p2'\Q
50-
Q = p2\P
51-
@test Q I
55+
test_1d_plans(p1, p2, x)
5256
end
5357
end
5458

@@ -62,87 +66,69 @@ FastTransforms.set_num_threads(ceil(Int, Base.Sys.CPU_THREADS/2))
6266
(plan_jac2ultra(Id, α, β, λ), plan_ultra2jac(Id, λ, α, β)),
6367
(plan_jac2cheb(Id, α, β), plan_cheb2jac(Id, α, β)),
6468
(plan_ultra2cheb(Id, λ), plan_cheb2ultra(Id, λ)))
65-
y = p1*x
66-
z = p2*y
67-
@test z x
68-
y = p1*x
69-
z = p1'y
70-
y = transpose(p1)*z
71-
z = transpose(p1)\y
72-
y = p1'\z
73-
z = p1\y
74-
@test z x
75-
y = p2*x
76-
z = p2'y
77-
y = transpose(p2)*z
78-
z = transpose(p2)\y
79-
y = p2'\z
80-
z = p2\y
81-
@test z x
82-
P = p1*I
83-
Q = p2*P
84-
@test_skip Q I
85-
P = p1*I
86-
Q = p1'P
87-
P = transpose(p1)*Q
88-
Q = transpose(p1)\P
89-
P = p1'\Q
90-
Q = p1\P
91-
@test_skip Q I
92-
P = p2*I
93-
Q = p2'P
94-
P = transpose(p2)*Q
95-
Q = transpose(p2)\P
96-
P = p2'\Q
97-
Q = p2\P
98-
@test_skip Q I
69+
test_1d_plans(p1, p2, x; skip=true)
9970
end
10071
end
10172

102-
for T in (Float64, Complex{Float64})
103-
A = T <: Real ? sphones(T, n, 2n-1) : sphones(T, n, 2n-1) + im*sphones(T, n, 2n-1)
104-
p = plan_sph2fourier(A)
105-
ps = plan_sph_synthesis(A)
106-
pa = plan_sph_analysis(A)
73+
function test_nd_plans(p, ps, pa, A)
10774
B = copy(A)
10875
C = ps*(p*A)
10976
A = p\(pa*C)
11077
@test A B
78+
end
11179

112-
A = T <: Real ? sphvones(T, n, 2n-1) : sphvones(T, n, 2n-1) + im*sphvones(T, n, 2n-1)
113-
p = plan_sphv2fourier(A)
114-
ps = plan_sphv_synthesis(A)
115-
pa = plan_sphv_analysis(A)
116-
B = copy(A)
117-
C = ps*(p*A)
118-
A = p\(pa*C)
119-
@test A B
80+
A = sphones(Float64, n, 2n-1)
81+
p = plan_sph2fourier(A)
82+
ps = plan_sph_synthesis(A)
83+
pa = plan_sph_analysis(A)
84+
test_nd_plans(p, ps, pa, A)
85+
A = sphones(Float64, n, 2n-1) + im*sphones(Float64, n, 2n-1)
86+
p = plan_sph2fourier(A)
87+
ps = plan_sph_synthesis(A)
88+
pa = plan_sph_analysis(A)
89+
test_nd_plans(p, ps, pa, A)
12090

121-
A = T <: Real ? diskones(T, n, 4n-3) : diskones(T, n, 4n-3) + im*diskones(T, n, 4n-3)
122-
p = plan_disk2cxf(A)
123-
ps = plan_disk_synthesis(A)
124-
pa = plan_disk_analysis(A)
125-
B = copy(A)
126-
C = ps*(p*A)
127-
A = p\(pa*C)
128-
@test A B
91+
A = sphvones(Float64, n, 2n-1)
92+
p = plan_sphv2fourier(A)
93+
ps = plan_sphv_synthesis(A)
94+
pa = plan_sphv_analysis(A)
95+
test_nd_plans(p, ps, pa, A)
96+
A = sphvones(Float64, n, 2n-1) + im*sphvones(Float64, n, 2n-1)
97+
p = plan_sphv2fourier(A)
98+
ps = plan_sphv_synthesis(A)
99+
pa = plan_sphv_analysis(A)
100+
test_nd_plans(p, ps, pa, A)
129101

130-
A = T <: Real ? triones(T, n, n) : triones(T, n, n) + im*triones(T, n, n)
131-
p = plan_tri2cheb(A, α, β, γ)
132-
ps = plan_tri_synthesis(A)
133-
pa = plan_tri_analysis(A)
134-
B = copy(A)
135-
C = ps*(p*A)
136-
A = p\(pa*C)
137-
@test A B
102+
A = diskones(Float64, n, 4n-3)
103+
p = plan_disk2cxf(A)
104+
ps = plan_disk_synthesis(A)
105+
pa = plan_disk_analysis(A)
106+
test_nd_plans(p, ps, pa, A)
107+
A = diskones(Float64, n, 4n-3) + im*diskones(Float64, n, 4n-3)
108+
p = plan_disk2cxf(A)
109+
ps = plan_disk_synthesis(A)
110+
pa = plan_disk_analysis(A)
111+
test_nd_plans(p, ps, pa, A)
138112

139-
A = T <: Real ? tetones(T, n, n, n) : tetones(T, n, n, n) + im*tetones(T, n, n, n)
140-
p = plan_tet2cheb(A, α, β, γ, δ)
141-
ps = plan_tet_synthesis(A)
142-
pa = plan_tet_analysis(A)
143-
B = copy(A)
144-
C = ps*(p*A)
145-
A = p\(pa*C)
146-
@test A B
147-
end
113+
A = triones(Float64, n, n)
114+
p = plan_tri2cheb(A, α, β, γ)
115+
ps = plan_tri_synthesis(A)
116+
pa = plan_tri_analysis(A)
117+
test_nd_plans(p, ps, pa, A)
118+
A = triones(Float64, n, n) + im*triones(Float64, n, n)
119+
p = plan_tri2cheb(A, α, β, γ)
120+
ps = plan_tri_synthesis(A)
121+
pa = plan_tri_analysis(A)
122+
test_nd_plans(p, ps, pa, A)
123+
124+
A = tetones(Float64, n, n, n)
125+
p = plan_tet2cheb(A, α, β, γ, δ)
126+
ps = plan_tet_synthesis(A)
127+
pa = plan_tet_analysis(A)
128+
test_nd_plans(p, ps, pa, A)
129+
A = tetones(Float64, n, n, n) + im*tetones(Float64, n, n, n)
130+
p = plan_tet2cheb(A, α, β, γ, δ)
131+
ps = plan_tet_synthesis(A)
132+
pa = plan_tet_analysis(A)
133+
test_nd_plans(p, ps, pa, A)
148134
end

test/runtests.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
using FastTransforms, Libdl, LinearAlgebra, Test
1+
using FastTransforms, LinearAlgebra, Test
22

33
include("specialfunctionstests.jl")
44

55
include("chebyshevtests.jl")
66

77
include("quadraturetests.jl")
88

9-
if find_library(FastTransforms.libfasttransforms) FastTransforms.libfasttransforms
10-
include("libfasttransformstests.jl")
11-
else
12-
error("FastTransforms is not properly installed. Please run Pkg.build(\"FastTransforms\") ",
13-
"and restart Julia.")
14-
end
9+
include("libfasttransformstests.jl")
1510

1611
include("nuffttests.jl")
1712

1813
include("fftBigFloattests.jl")
14+
1915
include("paduatests.jl")
2016

2117
include("gaunttests.jl")

0 commit comments

Comments
 (0)