@@ -6,6 +6,9 @@ using LinearAlgebra
66using Static
77
88@verbose @testset " Ultraspherical" begin
9+ @testset " promotion" begin
10+ @inferred (() -> [Ultraspherical (1 ), Ultraspherical (2.0 )])()
11+ end
912 @testset " identity fun" begin
1013 for d in (ChebyshevInterval (), 3 .. 4 , Segment (2 , 5 ), Segment (1 , 4im )), order in (1 , 2 , 0.5 )
1114 s = Ultraspherical (order, d)
@@ -25,27 +28,27 @@ using Static
2528
2629 # Conversions from Chebyshev to Ultraspherical should lead to a small union of types
2730 Tallowed = Union{
28- ApproxFunBase. ConcreteConversion{
29- Chebyshev{ChebyshevInterval{Float64}, Float64},
30- Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Float64},
31- ApproxFunBase. ConversionWrapper{TimesOperator{Float64, Tuple{Int64, Int64}}, Float64}};
31+ typeof (Conversion (Chebyshev (), Ultraspherical (1 ))),
32+ typeof (Conversion (Chebyshev (), Ultraspherical (2 )))};
3233 @inferred Tallowed Conversion (Chebyshev (), Ultraspherical (1 ));
3334 @inferred Tallowed Conversion (Chebyshev (), Ultraspherical (2 ));
35+ @inferred Conversion (Chebyshev (), Ultraspherical (static (2 )));
36+ @inferred Conversion (Chebyshev (), Ultraspherical (static (0.5 )));
37+ @inferred (() -> Conversion (Chebyshev (), Ultraspherical (2 )))();
38+ @inferred (() -> Conversion (Chebyshev (), Ultraspherical (0.5 )))();
39+ @inferred (() -> Conversion (Chebyshev (), Ultraspherical (2.5 )))();
40+
3441 # Conversions between Ultraspherical should lead to a small union of types
3542 Tallowed = Union{
36- ApproxFunBase. ConcreteConversion{
37- Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64},
38- Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}, Float64},
39- ApproxFunBase. ConversionWrapper{
40- ConstantOperator{Float64,
41- Ultraspherical{Int64, ChebyshevInterval{Float64}, Float64}}, Float64},
42- ApproxFunBase. ConversionWrapper{TimesOperator{Float64, Tuple{Int64, Int64}}, Float64}};
43+ typeof (Conversion (Ultraspherical (1 ), Ultraspherical (2 ))),
44+ typeof (Conversion (Ultraspherical (1 ), Ultraspherical (3 )))}
4345 @inferred Tallowed Conversion (Ultraspherical (1 ), Ultraspherical (2 ));
46+ @inferred Tallowed Conversion (Ultraspherical (1 ), Ultraspherical (3 ));
4447
4548 @inferred Conversion (Ultraspherical (static (1 )), Ultraspherical (static (4 )))
46- # these cases should be handled by constant-propagation
47- @inferred (() -> Conversion (Ultraspherical (static ( 1 )) , Ultraspherical (4 )))()
48- @inferred (() -> Conversion (Ultraspherical (1 ), Ultraspherical (static ( 4 ))))()
49+ @inferred (() -> Conversion ( Ultraspherical ( 1 ), Ultraspherical ( 4 )))()
50+ @inferred (() -> Conversion (Ultraspherical (1.0 ) , Ultraspherical (4.0 )))();
51+ @inferred (() -> Conversion (Ultraspherical (1.0 ), Ultraspherical (3.5 )))();
4952
5053 for n in (2 ,5 )
5154 C1 = Conversion (Chebyshev (), Ultraspherical (n))
@@ -62,19 +65,24 @@ using Static
6265 g = CLC * f
6366 @test g ≈ Fun (x-> x^ 2 , Chebyshev ())
6467
65- f = Fun (x-> x^ 2 , Chebyshev ()) # Legendre
66- CCL = Conversion (Chebyshev (), Ultraspherical (0.5 ))
67- @test ! isdiag (CCL)
68- g = CCL * f
69- @test g ≈ Fun (x-> x^ 2 , Ultraspherical (0.5 ))
70-
71- f = Fun (x-> x^ 2 , Ultraspherical (0.5 )) # Legendre
72- for n in (2.5 , 3 )
73- CLU = Conversion (Ultraspherical (0.5 ), Ultraspherical (n))
74- @test ! isdiag (CLU)
75- g = CLU * f
68+ for n in (0.5 , 1 , 1.5 , 2 )
69+ f = Fun (x-> x^ 2 , Chebyshev ())
70+ CCL = Conversion (Chebyshev (), Ultraspherical (n))
71+ @test ! isdiag (CCL)
72+ g = CCL * f
7673 @test g ≈ Fun (x-> x^ 2 , Ultraspherical (n))
7774 end
75+
76+ ff = x-> x^ 2 + 2 x^ 3 + 3 x^ 4
77+ for n1 in (0.5 , 1 )
78+ f = Fun (ff, Ultraspherical (n1))
79+ for n2 in (2.5 , 3 )
80+ CLU = Conversion (Ultraspherical (n1), Ultraspherical (n2))
81+ @test ! isdiag (CLU)
82+ g = CLU * f
83+ @test g ≈ Fun (ff, Ultraspherical (n1))
84+ end
85+ end
7886 end
7987
8088 @testset " Normalized space" begin
@@ -110,12 +118,12 @@ using Static
110118 @test transform (S, v) ≈ transform (J, v)
111119 end
112120 @testset for T in (Float32, Float64), ET in (T, complex (T))
113- v = Array {ET} (undef, 10 )
114- v2 = similar (v)
115- M = Array {ET} (undef, 10 , 10 )
116- M2 = similar (M)
117- A = Array {ET} (undef, 10 , 10 , 10 )
118- A2 = similar (A)
121+ v = Array {ET} (undef, 10 );
122+ v2 = similar (v);
123+ M = Array {ET} (undef, 10 , 10 );
124+ M2 = similar (M);
125+ A = Array {ET} (undef, 10 , 10 , 10 );
126+ A2 = similar (A);
119127 @testset for d in ((), (0 .. 1 ,)), order in (0.5 , 0.7 , 1.5 , 1 , 3 )
120128 U = Ultraspherical (order, d... )
121129 NU = NormalizedPolynomialSpace (U)
0 commit comments