@@ -27,35 +27,103 @@ import MultivariateOrthogonalPolynomials: rectspace, totensor, duffy2legendrecon
27
27
@test g (t,x,y) ≈ f ((t,x,y))
28
28
end
29
29
30
- @testset " Legendre<>DuffyConic" begin
31
- for k = 0 : 10
32
- a = [zeros (k); 1.0 ; zeros (5 )]
33
- F = totensor (rectspace (DuffyConic ()), a)
34
- F = pad (F, :, 2 size (F,1 )- 1 )
35
- T = eltype (a)
36
- P = c_plan_rottriangle (size (F,1 ), zero (T), zero (T), zero (T))
37
- @test legendre2duffyconic! (P, duffy2legendreconic! (P, copy (F))) ≈ F
38
-
39
- b = coefficients (a, LegendreConic (), DuffyConic ())
40
- @test a ≈ coefficients (b, DuffyConic (), LegendreConic ())[1 : length (a)]
30
+ @testset " Legendre<>DuffyConic" begin
31
+ for k = 0 : 10
32
+ a = [zeros (k); 1.0 ; zeros (5 )]
33
+ F = totensor (rectspace (DuffyConic ()), a)
34
+ F = pad (F, :, 2 size (F,1 )- 1 )
35
+ T = eltype (a)
36
+ P = c_plan_rottriangle (size (F,1 ), zero (T), zero (T), zero (T))
37
+ @test legendre2duffyconic! (P, duffy2legendreconic! (P, copy (F))) ≈ F
38
+
39
+ b = coefficients (a, LegendreConic (), DuffyConic ())
40
+ @test a ≈ coefficients (b, DuffyConic (), LegendreConic ())[1 : length (a)]
41
+ end
42
+ end
43
+
44
+ @testset " LegendreConicPlan" begin
45
+ for (m,ℓ) in ((0 ,0 ), (0 ,1 ), (0 ,2 ), (1 ,1 ), (1 ,2 ), (2 ,2 ))
46
+ f = (txy) -> ((t,x,y) = txy; θ = atan (y,x); Fun (NormalizedJacobi (0 ,2 m+ 1 ,Segment (1 ,0 )),[zeros (ℓ);1 ])(t) * 2 ^ m * t^ m * cos (m* θ))
47
+ g = Fun (f, LegendreConic ())
48
+ t,x,y = sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2
49
+ @test g (t,x,y) ≈ f ((t,x,y))
50
+ end
51
+ end
52
+
53
+ @testset " LegendreConic" begin
54
+ f = Fun ((t,x,y) -> 1 , LegendreConic (), 10 )
55
+ @test f. coefficients ≈ [1 ; zeros (ncoefficients (f)- 1 )]
56
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 1
57
+
58
+ f = Fun ((t,x,y) -> t, LegendreConic (), 10 )
59
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ sqrt (0.1 ^ 2 + 0.2 ^ 2 )
60
+ f = Fun ((t,x,y) -> 1 + t+ x+ y, LegendreConic (), 10 )
61
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 1 + sqrt (0.1 ^ 2 + 0.2 ^ 2 )+ 0.1 + 0.2
62
+
63
+
64
+ @time Fun ((t,x,y) -> 1 + t+ x+ y, LegendreConic (), 1000 )
41
65
end
42
66
end
43
67
44
68
45
- @testset " LegendreConicPlan" begin
46
- for (m,ℓ) in ((0 ,0 ), (0 ,1 ), (0 ,2 ), (1 ,1 ), (1 ,2 ), (2 ,2 ))
69
+ @testset " Cone" begin
70
+ @testset " rectspace" begin
71
+ rs = rectspace (DuffyCone ())
72
+ @test points (rs,10 ) isa Vector{SVector{3 ,Float64}}
73
+ end
74
+
75
+ @testset " DuffyCone" begin
76
+ f = Fun ((t,x,y) -> 1 , DuffyCone (), 10 )
77
+ @test f. coefficients ≈ [1 ; zeros (ncoefficients (f)- 1 )]
78
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 1
79
+
80
+ f = Fun ((t,x,y) -> t, DuffyConic (), 10 )
81
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ sqrt (0.1 ^ 2 + 0.2 ^ 2 )
82
+
83
+ f = Fun ((t,x,y) -> x, DuffyConic (), 10 )
84
+
85
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 0.1
86
+
87
+ f = Fun ((t,x,y) -> exp (cos (t* x)* y), DuffyConic (), 1000 )
88
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ exp (cos (sqrt (0.1 ^ 2 + 0.2 ^ 2 )* 0.1 )* 0.2 )
89
+
90
+ f = Fun ((t,x,y) -> exp (cos (t* x)* y), DuffyConic ())
91
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ exp (cos (sqrt (0.1 ^ 2 + 0.2 ^ 2 )* 0.1 )* 0.2 )
92
+
93
+ m,ℓ = (1 ,1 )
47
94
f = (txy) -> ((t,x,y) = txy; θ = atan (y,x); Fun (NormalizedJacobi (0 ,2 m+ 1 ,Segment (1 ,0 )),[zeros (ℓ);1 ])(t) * 2 ^ m * t^ m * cos (m* θ))
48
- g = Fun (f, LegendreConic ())
95
+ g = Fun (f, DuffyConic ())
49
96
t,x,y = sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2
50
97
@test g (t,x,y) ≈ f ((t,x,y))
51
98
end
52
- end
53
99
100
+ @testset " Legendre<>DuffyConic" begin
101
+ for k = 0 : 10
102
+ a = [zeros (k); 1.0 ; zeros (5 )]
103
+ F = totensor (rectspace (DuffyConic ()), a)
104
+ F = pad (F, :, 2 size (F,1 )- 1 )
105
+ T = eltype (a)
106
+ P = c_plan_rottriangle (size (F,1 ), zero (T), zero (T), zero (T))
107
+ @test legendre2duffyconic! (P, duffy2legendreconic! (P, copy (F))) ≈ F
108
+
109
+ b = coefficients (a, LegendreConic (), DuffyConic ())
110
+ @test a ≈ coefficients (b, DuffyConic (), LegendreConic ())[1 : length (a)]
111
+ end
112
+ end
113
+
114
+ @testset " LegendreConicPlan" begin
115
+ for (m,ℓ) in ((0 ,0 ), (0 ,1 ), (0 ,2 ), (1 ,1 ), (1 ,2 ), (2 ,2 ))
116
+ f = (txy) -> ((t,x,y) = txy; θ = atan (y,x); Fun (NormalizedJacobi (0 ,2 m+ 1 ,Segment (1 ,0 )),[zeros (ℓ);1 ])(t) * 2 ^ m * t^ m * cos (m* θ))
117
+ g = Fun (f, LegendreConic ())
118
+ t,x,y = sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2
119
+ @test g (t,x,y) ≈ f ((t,x,y))
120
+ end
121
+ end
54
122
55
- @testset " LegendreConic" begin
56
- f = Fun ((t,x,y) -> 1 , LegendreConic (), 10 )
57
- @test f. coefficients ≈ [1 ; zeros (ncoefficients (f)- 1 )]
58
- @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 1
123
+ @testset " LegendreConic" begin
124
+ f = Fun ((t,x,y) -> 1 , LegendreConic (), 10 )
125
+ @test f. coefficients ≈ [1 ; zeros (ncoefficients (f)- 1 )]
126
+ @test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ 1
59
127
60
128
f = Fun ((t,x,y) -> t, LegendreConic (), 10 )
61
129
@test f (sqrt (0.1 ^ 2 + 0.2 ^ 2 ),0.1 ,0.2 ) ≈ sqrt (0.1 ^ 2 + 0.2 ^ 2 )
65
133
66
134
@time Fun ((t,x,y) -> 1 + t+ x+ y, LegendreConic (), 1000 )
67
135
end
68
- end
136
+ end
0 commit comments