1
- using FastTransforms, Test
1
+ using FastTransforms, Test, Random
2
2
import FastTransforms: th_leg2cheb, th_cheb2leg, th_leg2chebu, th_ultra2ultra,th_jac2jac, th_leg2chebu,
3
3
lib_leg2cheb, lib_cheb2leg, lib_ultra2ultra, lib_jac2jac,
4
- plan_th_cheb2leg!, plan_th_leg2chebu!, plan_th_leg2cheb!, plan_th_ultra2ultra!, plan_th_jac2jac!
4
+ plan_th_cheb2leg!, plan_th_leg2chebu!, plan_th_leg2cheb!, plan_th_ultra2ultra!, plan_th_jac2jac!,
5
+ th_cheb2jac, th_jac2cheb
6
+
7
+ Random. seed! (0 )
5
8
6
9
@testset " ToeplitzHankel" begin
7
10
for x in ([1.0 ], [1.0 ,2 ,3 ,4 ,5 ], [1.0 + im,2 - 3im ,3 + 4im ,4 - 5im ,5 + 10im ], collect (1.0 : 1000 ))
@@ -26,11 +29,14 @@ import FastTransforms: th_leg2cheb, th_cheb2leg, th_leg2chebu, th_ultra2ultra,th
26
29
@test th_jac2jac (x, - 1 / 2 ,- 1 / 2 ,1 / 2 ,0 ) ≈ lib_jac2jac (x, - 1 / 2 ,- 1 / 2 ,1 / 2 ,0 )
27
30
@test th_jac2jac (x, - 1 / 2 ,- 1 / 2 ,0 ,1 / 2 ) ≈ lib_jac2jac (x, - 1 / 2 ,- 1 / 2 ,0 ,1 / 2 )
28
31
@test th_jac2jac (x, - 3 / 4 ,- 3 / 4 ,0 ,3 / 4 ) ≈ lib_jac2jac (x, - 3 / 4 ,- 3 / 4 ,0 ,3 / 4 )
29
- @test th_jac2jac (x,0 , 0 , 5 , 5 ) ≈ lib_jac2jac (x, 0 , 0 , 5 , 5 )
30
32
if length (x) < 10
33
+ @test th_jac2jac (x,0 , 0 , 5 , 5 ) ≈ lib_jac2jac (x, 0 , 0 , 5 , 5 )
31
34
@test th_jac2jac (x, 5 , 5 , 0 , 0 ) ≈ lib_jac2jac (x, 5 , 5 , 0 , 0 )
32
35
end
33
36
37
+ @test th_cheb2jac (x, 0.2 , 0.3 ) ≈ cheb2jac (x, 0.2 , 0.3 )
38
+ @test th_jac2cheb (x, 0.2 , 0.3 ) ≈ jac2cheb (x, 0.2 , 0.3 )
39
+
34
40
@test th_cheb2leg (th_leg2cheb (x)) ≈ x
35
41
@test th_leg2cheb (th_cheb2leg (x)) ≈ x
36
42
@test th_ultra2ultra (th_ultra2ultra (x, 0.1 , 0.6 ), 0.6 , 0.1 ) ≈ x
@@ -93,6 +99,18 @@ import FastTransforms: th_leg2cheb, th_cheb2leg, th_leg2chebu, th_ultra2ultra,th
93
99
@test th_jac2jac (X, 0.1 , 0.6 , 3.1 , 2.8 , 1 ) ≈ hcat ([jac2jac (X[:,j], 0.1 , 0.6 , 3.1 , 2.8 ) for j= 1 : size (X,2 )]. .. )
94
100
@test th_jac2jac (X, 0.1 , 0.6 , 3.1 , 2.8 , 2 ) ≈ vcat ([permutedims (jac2jac (X[k,:], 0.1 , 0.6 , 3.1 , 2.8 )) for k= 1 : size (X,1 )]. .. )
95
101
@test th_jac2jac (X, 0.1 , 0.6 , 3.1 , 2.8 ) ≈ th_jac2jac (th_jac2jac (X, 0.1 , 0.6 , 3.1 , 2.8 , 1 ), 0.1 , 0.6 , 3.1 , 2.8 , 2 )
102
+
103
+ @test th_jac2jac (X, - 0.5 , - 0.5 , 3.1 , 2.8 , 1 ) ≈ hcat ([jac2jac (X[:,j], - 0.5 , - 0.5 , 3.1 , 2.8 ) for j= 1 : size (X,2 )]. .. )
104
+ @test th_jac2jac (X, - 0.5 , - 0.5 , 3.1 , 2.8 , 2 ) ≈ vcat ([permutedims (jac2jac (X[k,:], - 0.5 , - 0.5 , 3.1 , 2.8 )) for k= 1 : size (X,1 )]. .. )
105
+ @test th_jac2jac (X, - 0.5 , - 0.5 , 3.1 , 2.8 ) ≈ th_jac2jac (th_jac2jac (X, - 0.5 , - 0.5 , 3.1 , 2.8 , 1 ), - 0.5 , - 0.5 , 3.1 , 2.8 , 2 )
106
+
107
+ @test th_cheb2jac (X, 3.1 , 2.8 , 1 ) ≈ hcat ([cheb2jac (X[:,j], 3.1 , 2.8 ) for j= 1 : size (X,2 )]. .. )
108
+ @test th_cheb2jac (X, 3.1 , 2.8 , 2 ) ≈ vcat ([permutedims (cheb2jac (X[k,:], 3.1 , 2.8 )) for k= 1 : size (X,1 )]. .. )
109
+ @test th_cheb2jac (X, 3.1 , 2.8 ) ≈ th_cheb2jac (th_cheb2jac (X, 3.1 , 2.8 , 1 ), 3.1 , 2.8 , 2 )
110
+
111
+ @test th_jac2cheb (X, 3.1 , 2.8 , 1 ) ≈ hcat ([jac2cheb (X[:,j], 3.1 , 2.8 ) for j= 1 : size (X,2 )]. .. )
112
+ @test th_jac2cheb (X, 3.1 , 2.8 , 2 ) ≈ vcat ([permutedims (jac2cheb (X[k,:], 3.1 , 2.8 )) for k= 1 : size (X,1 )]. .. )
113
+ @test th_jac2cheb (X, 3.1 , 2.8 ) ≈ th_jac2cheb (th_jac2cheb (X, 3.1 , 2.8 , 1 ), 3.1 , 2.8 , 2 )
96
114
end
97
115
98
116
@testset " BigFloat" begin
0 commit comments