|
1 | 1 | @testset "Functional" begin
|
2 |
| - x = π*rand(1500) |
3 |
| - y = π*rand(1500) |
| 2 | + x = π*rand(100) |
| 3 | + y = π*rand(100) |
4 | 4 | t = Table(; x, y)
|
5 | 5 | T = Functional(cos)
|
6 | 6 | n, c = apply(T, t)
|
|
9 | 9 | tₒ = revert(T, n, c)
|
10 | 10 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
11 | 11 |
|
12 |
| - x = 2*(rand(1500) .- 0.5) |
13 |
| - y = 2*(rand(1500) .- 0.5) |
| 12 | + x = 2*(rand(100) .- 0.5) |
| 13 | + y = 2*(rand(100) .- 0.5) |
14 | 14 | t = Table(; x, y)
|
15 | 15 | T = Functional(acos)
|
16 | 16 | n, c = apply(T, t)
|
|
19 | 19 | tₒ = revert(T, n, c)
|
20 | 20 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
21 | 21 |
|
22 |
| - x = π*(rand(1500) .- 0.5) |
23 |
| - y = π*(rand(1500) .- 0.5) |
| 22 | + x = π*(rand(100) .- 0.5) |
| 23 | + y = π*(rand(100) .- 0.5) |
24 | 24 | t = Table(; x, y)
|
25 | 25 | T = Functional(sin)
|
26 | 26 | n, c = apply(T, t)
|
|
29 | 29 | tₒ = revert(T, n, c)
|
30 | 30 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
31 | 31 |
|
32 |
| - x = 2*(rand(1500) .- 0.5) |
33 |
| - y = 2*(rand(1500) .- 0.5) |
| 32 | + x = 2*(rand(100) .- 0.5) |
| 33 | + y = 2*(rand(100) .- 0.5) |
34 | 34 | t = Table(; x, y)
|
35 | 35 | T = Functional(asin)
|
36 | 36 | n, c = apply(T, t)
|
|
39 | 39 | tₒ = revert(T, n, c)
|
40 | 40 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
41 | 41 |
|
42 |
| - x = rand(Normal(0,25), 1500) |
43 |
| - y = x + rand(Normal(10,2), 1500) |
| 42 | + x = rand(Normal(0,25), 100) |
| 43 | + y = x + rand(Normal(10,2), 100) |
44 | 44 | t = Table(; x, y)
|
45 | 45 | T = Functional(exp)
|
46 | 46 | n, c = apply(T, t)
|
|
49 | 49 | tₒ = revert(T, n, c)
|
50 | 50 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
51 | 51 |
|
52 |
| - x = rand(Normal(0,25), 1500) |
53 |
| - y = x + rand(Normal(10,2), 1500) |
| 52 | + x = rand(Normal(0,25), 100) |
| 53 | + y = x + rand(Normal(10,2), 100) |
54 | 54 | t = Table(; x, y)
|
55 | 55 | T = Functional(x -> x)
|
56 | 56 | n, c = apply(T, t)
|
57 | 57 | @test t == n
|
58 | 58 | @test !isrevertible(T)
|
59 | 59 |
|
60 | 60 | # functor tests
|
61 |
| - x = rand(1500) |
62 |
| - y = rand(1500) |
| 61 | + x = rand(100) |
| 62 | + y = rand(100) |
63 | 63 | t = Table(; x, y)
|
64 | 64 | f = Polynomial(1, 2, 3) # f(x) = 1 + 2x + 3x²
|
65 | 65 | T = Functional(f)
|
|
71 | 71 | @test !isrevertible(T)
|
72 | 72 |
|
73 | 73 | # apply functions to specific columns
|
74 |
| - x = π*rand(1500) |
75 |
| - y = 2*(rand(1500) .- 0.5) |
| 74 | + x = π*rand(100) |
| 75 | + y = 2*(rand(100) .- 0.5) |
76 | 76 | z = x + y
|
77 | 77 | t = Table(; x, y, z)
|
78 | 78 | T = Functional(1 => cos, 2 => acos)
|
|
83 | 83 | tₒ = revert(T, n, c)
|
84 | 84 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
85 | 85 |
|
86 |
| - x = π*rand(1500) |
87 |
| - y = π*(rand(1500) .- 0.5) |
| 86 | + x = π*rand(100) |
| 87 | + y = π*(rand(100) .- 0.5) |
88 | 88 | z = x + y
|
89 | 89 | t = Table(; x, y, z)
|
90 | 90 | T = Functional(:x => cos, :y => sin)
|
|
95 | 95 | tₒ = revert(T, n, c)
|
96 | 96 | @test Tables.matrix(t) ≈ Tables.matrix(tₒ)
|
97 | 97 |
|
98 |
| - x = 2*(rand(1500) .- 0.5) |
99 |
| - y = 2*(rand(1500) .- 0.5) |
| 98 | + x = 2*(rand(100) .- 0.5) |
| 99 | + y = 2*(rand(100) .- 0.5) |
100 | 100 | z = x + y
|
101 | 101 | t = Table(; x, y, z)
|
102 | 102 | T = Functional("x" => acos, "y" => asin)
|
|
121 | 121 | @test !isrevertible(T)
|
122 | 122 |
|
123 | 123 | # row table
|
124 |
| - x = π*rand(1500) |
125 |
| - y = π*rand(1500) |
| 124 | + x = π*rand(100) |
| 125 | + y = π*rand(100) |
126 | 126 | t = Table(; x, y)
|
127 | 127 | rt = Tables.rowtable(t)
|
128 | 128 | T = Functional(cos)
|
|
0 commit comments