|
151 | 151 | end
|
152 | 152 | end
|
153 | 153 |
|
| 154 | + @testset "Functional" begin |
| 155 | + x = π*rand(1500) |
| 156 | + y = π*rand(1500) |
| 157 | + t = Table(; x, y) |
| 158 | + T = Functional(cos) |
| 159 | + n, c = apply(T, t) |
| 160 | + @test all(x -> -1 <= x <= 1, n.x) |
| 161 | + @test all(y -> -1 <= y <= 1, n.y) |
| 162 | + tₒ = revert(T, n, c) |
| 163 | + @test Tables.matrix(t) ≈ Tables.matrix(tₒ) |
| 164 | + |
| 165 | + x = 2*(rand(1500) .- 0.5) |
| 166 | + y = 2*(rand(1500) .- 0.5) |
| 167 | + t = Table(; x, y) |
| 168 | + T = Functional(acos) |
| 169 | + n, c = apply(T, t) |
| 170 | + @test all(x -> 0 <= x <= π, n.x) |
| 171 | + @test all(y -> 0 <= y <= π, n.y) |
| 172 | + tₒ = revert(T, n, c) |
| 173 | + @test Tables.matrix(t) ≈ Tables.matrix(tₒ) |
| 174 | + |
| 175 | + x = π*(rand(1500) .- 0.5) |
| 176 | + y = π*(rand(1500) .- 0.5) |
| 177 | + t = Table(; x, y) |
| 178 | + T = Functional(sin) |
| 179 | + n, c = apply(T, t) |
| 180 | + @test all(x -> -1 <= x <= 1, n.x) |
| 181 | + @test all(y -> -1 <= y <= 1, n.y) |
| 182 | + tₒ = revert(T, n, c) |
| 183 | + @test Tables.matrix(t) ≈ Tables.matrix(tₒ) |
| 184 | + |
| 185 | + x = 2*(rand(1500) .- 0.5) |
| 186 | + y = 2*(rand(1500) .- 0.5) |
| 187 | + t = Table(; x, y) |
| 188 | + T = Functional(asin) |
| 189 | + n, c = apply(T, t) |
| 190 | + @test all(x -> -π/2 <= x <= π/2, n.x) |
| 191 | + @test all(y -> -π/2 <= y <= π/2, n.y) |
| 192 | + tₒ = revert(T, n, c) |
| 193 | + @test Tables.matrix(t) ≈ Tables.matrix(tₒ) |
| 194 | + |
| 195 | + x = rand(Normal(0,25), 1500) |
| 196 | + y = x + rand(Normal(10,2), 1500) |
| 197 | + t = Table(; x, y) |
| 198 | + T = Functional(exp) |
| 199 | + n, c = apply(T, t) |
| 200 | + @test all(x -> x > 0, n.x) |
| 201 | + @test all(y -> y > 0, n.y) |
| 202 | + tₒ = revert(T, n, c) |
| 203 | + @test Tables.matrix(t) ≈ Tables.matrix(tₒ) |
| 204 | + |
| 205 | + x = rand(Normal(0,25), 1500) |
| 206 | + y = x + rand(Normal(10,2), 1500) |
| 207 | + t = Table(; x, y) |
| 208 | + T = Functional(x -> x) |
| 209 | + n, c = apply(T, t) |
| 210 | + @test t == n |
| 211 | + @test isrevertible(T) == false |
| 212 | + end |
| 213 | + |
154 | 214 | @testset "EigenAnalysis" begin
|
155 | 215 | # PCA test
|
156 | 216 | x = rand(Normal(0,10), 1500)
|
|
0 commit comments