Skip to content

Commit 6cf4e39

Browse files
authored
revert to libfasttransforms as default (#208)
1 parent 13ea614 commit 6cf4e39

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

src/FastTransforms.jl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,21 @@ for f in (:jac2jac,
118118
:cheb2jac, :ultra2cheb, :cheb2ultra, :associatedjac2jac,
119119
:modifiedjac2jac, :modifiedlag2lag, :modifiedherm2herm,
120120
:sph2fourier, :sphv2fourier, :disk2cxf, :ann2cxf,
121-
:rectdisk2cheb, :tri2cheb, :tet2cheb)
121+
:rectdisk2cheb, :tri2cheb, :tet2cheb,
122+
:leg2cheb, :cheb2leg, :ultra2ultra)
122123
lib_f = Symbol("lib_", f)
123124
@eval $f(x::AbstractArray, y...; z...) = $lib_f(x, y...; z...)
124125
end
125126

126127
# following use Toeplitz-Hankel to avoid expensive plans
127-
for f in (:leg2cheb, :cheb2leg, :ultra2ultra)
128-
th_f = Symbol("th_", f)
129-
lib_f = Symbol("lib_", f)
130-
@eval begin
131-
$f(x::AbstractArray, y...; z...) = $th_f(x, y...; z...)
132-
# $f(x::AbstractArray, y...; z...) = $lib_f(x, y...; z...)
133-
end
134-
end
128+
# for f in (:leg2cheb, :cheb2leg, :ultra2ultra)
129+
# th_f = Symbol("th_", f)
130+
# lib_f = Symbol("lib_", f)
131+
# @eval begin
132+
# $f(x::AbstractArray, y...; z...) = $th_f(x, y...; z...)
133+
# # $f(x::AbstractArray, y...; z...) = $lib_f(x, y...; z...)
134+
# end
135+
# end
135136

136137

137138
end # module

test/toeplitzhankeltests.jl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,22 @@ import FastTransforms: th_leg2cheb, th_cheb2leg, th_ultra2ultra,th_jac2jac, th_l
1212
@test th_jac2jac(x,0.1, 0.2,0.1,0.4) lib_jac2jac(x, 0.1, 0.2,0.1,0.4)
1313
@test th_jac2jac(x,0.1, 0.2,0.3,0.2) lib_jac2jac(x, 0.1, 0.2,0.3,0.2)
1414

15-
@test all(th_leg2cheb(x) .=== leg2cheb(x))
16-
@test all(th_cheb2leg(x) .=== cheb2leg(x))
1715

1816
@test th_cheb2leg(th_leg2cheb(x)) x atol=1E-9
1917
@test th_leg2cheb(th_cheb2leg(x)) x atol=1E-10
2018
end
2119

2220
for X in (randn(5,4), randn(5,4) + im*randn(5,4))
23-
@test th_leg2cheb(X, 1) leg2cheb(X, 1) hcat([leg2cheb(X[:,j]) for j=1:size(X,2)]...)
24-
@test th_leg2cheb(X, 2) leg2cheb(X, 2) vcat([permutedims(leg2cheb(X[k,:])) for k=1:size(X,1)]...)
25-
@test th_leg2cheb(X) leg2cheb(X) th_leg2cheb(th_leg2cheb(X, 1), 2)
21+
@test th_leg2cheb(X, 1) hcat([leg2cheb(X[:,j]) for j=1:size(X,2)]...)
22+
@test_broken th_leg2cheb(X, 1) leg2cheb(X, 1)
23+
@test th_leg2cheb(X, 2) vcat([permutedims(leg2cheb(X[k,:])) for k=1:size(X,1)]...)
24+
@test_broken th_leg2cheb(X, 2) leg2cheb(X, 2)
25+
@test th_leg2cheb(X) th_leg2cheb(th_leg2cheb(X, 1), 2)
26+
@test_broken th_leg2cheb(X) leg2cheb(X)
2627

27-
@test th_cheb2leg(X, 1) cheb2leg(X, 1) hcat([cheb2leg(X[:,j]) for j=1:size(X,2)]...)
28-
@test th_cheb2leg(X, 2) cheb2leg(X, 2) vcat([permutedims(cheb2leg(X[k,:])) for k=1:size(X,1)]...)
29-
@test th_cheb2leg(X) cheb2leg(X) th_cheb2leg(th_cheb2leg(X, 1), 2)
28+
@test th_cheb2leg(X, 1) hcat([cheb2leg(X[:,j]) for j=1:size(X,2)]...)
29+
@test th_cheb2leg(X, 2) vcat([permutedims(cheb2leg(X[k,:])) for k=1:size(X,1)]...)
30+
@test th_cheb2leg(X) th_cheb2leg(th_cheb2leg(X, 1), 2)
3031

3132
@test th_cheb2leg(X) == plan_th_cheb2leg!(X, 1:2)*copy(X)
3233
@test th_leg2cheb(X) == plan_th_leg2cheb!(X, 1:2)*copy(X)
@@ -37,16 +38,16 @@ import FastTransforms: th_leg2cheb, th_cheb2leg, th_ultra2ultra,th_jac2jac, th_l
3738
@testset "BigFloat" begin
3839
n = 10
3940
x = big.(collect(1.0:n))
40-
@test leg2cheb(x) lib_leg2cheb(x)
41-
@test cheb2leg(x) lib_cheb2leg(x)
41+
@test th_leg2cheb(x) lib_leg2cheb(x)
42+
@test th_cheb2leg(x) lib_cheb2leg(x)
4243
end
4344

4445
@testset "jishnub example" begin
4546
x = chebyshevpoints(4096);
4647
f = x -> cospi(1000x);
4748
y = f.(x);
48-
v = cheb2leg(chebyshevtransform(y))
49-
@test norm(v - cheb2leg(leg2cheb(v)), Inf)  1E-13
50-
@test norm(v - cheb2leg(leg2cheb(v)))/norm(v) 1E-14
49+
v = th_cheb2leg(chebyshevtransform(y))
50+
@test norm(v - th_cheb2leg(th_leg2cheb(v)), Inf)  1E-13
51+
@test norm(v - th_cheb2leg(th_leg2cheb(v)))/norm(v) 1E-14
5152
end
5253
end

0 commit comments

Comments
 (0)