@@ -8,85 +8,72 @@ import ApproxFunOrthogonalPolynomials: forwardrecurrence
8
8
end
9
9
10
10
@testset " ChebyshevInterval" begin
11
- @test Fun (x-> 2 ,10 )(.1 ) ≈ 2
12
- @test Fun (x-> 2 )(.1 ) ≈ 2
13
- @test Fun (Chebyshev,Float64[]).([0. ,1. ]) ≈ [0. ,0. ]
14
- @test Fun (Chebyshev,[])(0. ) ≈ 0.
15
- @test Fun (x-> 4 ,Chebyshev (),1 ). coefficients == [4.0 ]
16
- @test Fun (x-> 4 ). coefficients == [4.0 ]
17
- @test Fun (4 ). coefficients == [4.0 ]
11
+ @test @inferred Fun (x-> 2 ,10 )(.1 ) ≈ 2
12
+ @test @inferred Fun (x-> 2 )(.1 ) ≈ 2
13
+ @test @inferred Fun (Chebyshev,Float64[]).([0. ,1. ]) ≈ [0. ,0. ]
14
+ @test @inferred Fun (Chebyshev,[])(0. ) ≈ 0.
15
+ @test @inferred Fun (x-> 4 ,Chebyshev (),1 ). coefficients == [4.0 ]
16
+ @test @inferred Fun (x-> 4 ). coefficients == [4.0 ]
17
+ @test @inferred Fun (4 ). coefficients == [4.0 ]
18
18
19
19
20
- @test Fun (x-> 4 ). coefficients == [4.0 ]
21
- @test Fun (4 ). coefficients == [4.0 ]
20
+ @test @inferred Fun (x-> 4 ). coefficients == [4.0 ]
21
+ @test @inferred Fun (4 ). coefficients == [4.0 ]
22
22
23
- f = Fun (ChebyshevInterval (), [1 ])
23
+ f = @inferred Fun (ChebyshevInterval (), [1 ])
24
24
@test f (0.1 ) == 1
25
25
26
- ef = Fun (exp)
27
- @test ef (0.1 ) ≈ exp (0.1 )
26
+ ef = @inferred Fun (exp)
27
+ @test @inferred ef (0.1 ) ≈ exp (0.1 )
28
+ @test @inferred ef (.5 ) ≈ exp (.5 )
28
29
29
30
for d in (ChebyshevInterval (),Interval (1. ,2. ),Segment (1.0 + im,2.0 + 2im ))
30
31
testspace (Chebyshev (d))
31
32
end
32
33
33
- ef = Fun (exp,ChebyshevInterval ())
34
-
35
- @test ef == - (- ef)
36
- @test ef == (ef- 1 ) + 1
37
-
38
- ef = Fun (exp)
39
-
40
- cf = Fun (cos)
41
-
42
- ecf = Fun (x-> cos (x).* exp (x))
43
- eocf = Fun (x-> cos (x)./ exp (x))
44
-
45
- @test ef (.5 ) ≈ exp (.5 )
46
- @test ecf (.123456 ) ≈ cos (.123456 ).* exp (.123456 )
34
+ y = @inferred Fun () + Fun (ChebyshevInterval {BigFloat} ())
35
+ @test y == 2 Fun ()
47
36
end
48
37
49
38
@testset " Algebra" begin
50
- ef = Fun (exp,ChebyshevInterval ())
51
-
52
- @test ef == - (- ef)
39
+ ef = @inferred Fun (exp,ChebyshevInterval ())
40
+ @test ef == @inferred - (- ef)
53
41
@test ef == (ef- 1 ) + 1
54
42
55
- @test ef / 3 == (3 \ ef)
56
-
43
+ @test (@inferred ef / 3 ) == @inferred (3 \ ef)
57
44
58
45
cf = Fun (cos)
59
46
60
- ecf = Fun (x-> cos (x).* exp (x))
61
- eocf = Fun (x-> cos (x)./ exp (x))
47
+ ecf = @inferred Fun (x-> cos (x).* exp (x))
48
+ eocf = @inferred Fun (x-> cos (x)./ exp (x))
62
49
63
50
@test ef (.5 ) ≈ exp (.5 )
64
51
@test ecf (.123456 ) ≈ cos (.123456 ).* exp (.123456 )
65
52
66
53
r= 2 .* rand (100 ) .- 1
67
54
68
- @test maximum (abs,ef .(r)- exp .(r))< 200 eps ()
69
- @test maximum (abs,ecf .(r).- cos .(r).* exp .(r))< 200 eps ()
55
+ @test @inferred maximum (abs,ef .(r)- exp .(r))< 200 eps ()
56
+ @test @inferred maximum (abs,ecf .(r).- cos .(r).* exp .(r))< 200 eps ()
70
57
71
- @test (cf .* ef)(0.1 ) ≈ ecf (0.1 ) ≈ cos (0.1 )* exp (0.1 )
72
- @test domain (cf.* ef) ≈ domain (ecf)
73
- @test domain (cf.* ef) == domain (ecf)
58
+ @test (@inferred ( cf .* ef)(0.1 ) ) ≈ ecf (0.1 ) ≈ cos (0.1 )* exp (0.1 )
59
+ @test ( @inferred domain (cf.* ef) ) ≈ domain (ecf)
60
+ @test ( @inferred domain (cf.* ef) ) == domain (ecf)
74
61
75
- @test norm ((ecf- cf.* ef). coefficients)< 200 eps ()
76
- @test maximum (abs,( eocf- cf./ ef). coefficients)< 1000 eps ()
62
+ @test norm (@inferred (ecf- cf.* ef). coefficients)< 200 eps ()
63
+ @test maximum (abs,@inferred (( eocf- cf./ ef) ). coefficients)< 1000 eps ()
77
64
@test norm (((ef/ 3 ). * (3 / ef)- 1 ). coefficients)< 1000 eps ()
78
65
end
79
66
80
67
@testset " Diff and cumsum" begin
81
68
ef = Fun (exp)
82
69
cf = Fun (cos)
83
- @test norm ((ef - ef' ). coefficients)< 10E-11
70
+ @test norm (@inferred (ef - ef' ). coefficients)< 10E-11
84
71
85
- @test norm ((ef - cumsum (ef)' ). coefficients) < 20 eps ()
86
- @test norm ((cf - cumsum (cf)' ). coefficients) < 20 eps ()
72
+ @test norm (@inferred (ef - cumsum (ef)' ). coefficients) < 20 eps ()
73
+ @test norm (@inferred (cf - cumsum (cf)' ). coefficients) < 20 eps ()
87
74
88
- @test sum (ef) ≈ 2.3504023872876028
89
- @test norm (ef) ≈ 1.90443178083307
75
+ @test @inferred ( sum (ef) ) ≈ 2.3504023872876028
76
+ @test @inferred ( norm (ef) ) ≈ 1.90443178083307
90
77
end
91
78
92
79
@testset " other domains" begin
0 commit comments