diff --git a/test/operators/directional.jl b/test/operators/directional.jl index 69a425a..0824a09 100644 --- a/test/operators/directional.jl +++ b/test/operators/directional.jl @@ -22,7 +22,7 @@ y = f.(x) v /= norm(v) ∇v = directional(x, v, PHS3(2)) exact = map(x -> SVector(df_dx(x), df_dy(x)) ⋅ v, x) - @test mean_percent_error(∇v(y), exact) < 2 + @test mean_percent_error(∇v(y), exact) < 5 end @testset "Direction Vector for Each Data Center" begin @@ -32,7 +32,7 @@ end end ∇v = directional(x, v, PHS3(2)) exact = map((x, vv) -> SVector(df_dx(x), df_dy(x)) ⋅ vv, x, v) - @test mean_percent_error(∇v(y), exact) < 2 + @test mean_percent_error(∇v(y), exact) < 5 end @testset "Different Evaluation Points" begin @@ -43,5 +43,5 @@ end end ∇v = directional(x, x2, v, PHS3(2)) exact = map((x, vv) -> SVector(df_dx(x), df_dy(x)) ⋅ vv, x2, v) - @test mean_percent_error(∇v(y), exact) < 2 + @test mean_percent_error(∇v(y), exact) < 5 end diff --git a/test/operators/gradient.jl b/test/operators/gradient.jl index e609dea..eceeeef 100644 --- a/test/operators/gradient.jl +++ b/test/operators/gradient.jl @@ -19,14 +19,14 @@ y = f.(x) @testset "First Derivative gradients" begin ∇ = gradient(x, PHS(3; poly_deg=2)) ∇y = ∇(y) - @test mean_percent_error(∇y[1], df_dx.(x)) < 2 - @test mean_percent_error(∇y[2], df_dy.(x)) < 2 + @test mean_percent_error(∇y[1], df_dx.(x)) < 5 + @test mean_percent_error(∇y[2], df_dy.(x)) < 5 end @testset "Different Evaluation Points" begin x2 = map(x -> SVector{2}(rand(2)), 1:100) ∇ = gradient(x, x2, PHS(3; poly_deg=2)) ∇y = ∇(y) - @test mean_percent_error(∇y[1], df_dx.(x2)) < 2 - @test mean_percent_error(∇y[2], df_dy.(x2)) < 2 + @test mean_percent_error(∇y[1], df_dx.(x2)) < 5 + @test mean_percent_error(∇y[2], df_dy.(x2)) < 5 end diff --git a/test/operators/laplacian.jl b/test/operators/laplacian.jl index 7affb57..57b2e29 100644 --- a/test/operators/laplacian.jl +++ b/test/operators/laplacian.jl @@ -17,17 +17,17 @@ y = f.(x) @testset "Laplacian" begin ∇² = laplacian(x, PHS(3; poly_deg=4)) - @test mean_percent_error(∇²(y), ∇²f.(x)) < 2 + @test mean_percent_error(∇²(y), ∇²f.(x)) < 5 ∇² = laplacian(x, IMQ(1; poly_deg=4)) - @test mean_percent_error(∇²(y), ∇²f.(x)) < 2 + @test mean_percent_error(∇²(y), ∇²f.(x)) < 5 ∇² = laplacian(x, Gaussian(1; poly_deg=4)) - @test mean_percent_error(∇²(y), ∇²f.(x)) < 2 + @test mean_percent_error(∇²(y), ∇²f.(x)) < 5 end @testset "Different Evaluation Points" begin x2 = map(x -> SVector{2}(rand(MersenneTwister(x), 2)), (N + 1):(N + 1000)) ∇² = laplacian(x, x2, PHS(3; poly_deg=4)) - @test mean_percent_error(∇²(y), ∇²f.(x2)) < 2 + @test mean_percent_error(∇²(y), ∇²f.(x2)) < 5 end diff --git a/test/operators/partial.jl b/test/operators/partial.jl index aaac527..86bb900 100644 --- a/test/operators/partial.jl +++ b/test/operators/partial.jl @@ -20,22 +20,22 @@ y = f.(x) @testset "Polyharmonic Splines" begin ∂x = partial(x, 1, 1, PHS(3; poly_deg=2)) ∂y = partial(x, 1, 2, PHS(3; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end @testset "Inverse Multiquadrics" begin ∂x = partial(x, 1, 1, IMQ(1; poly_deg=2)) ∂y = partial(x, 1, 2, IMQ(1; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end @testset "Gaussian" begin ∂x = partial(x, 1, 1, Gaussian(1; poly_deg=2)) ∂y = partial(x, 1, 2, Gaussian(1; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end end @@ -43,22 +43,22 @@ end @testset "Polyharmonic Splines" begin ∂2x = partial(x, 2, 1, PHS(3; poly_deg=4)) ∂2y = partial(x, 2, 2, PHS(3; poly_deg=4)) - @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 2 - @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 2 + @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 5 + @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 5 end @testset "Inverse Multiquadrics" begin ∂2x = partial(x, 2, 1, IMQ(1; poly_deg=4)) ∂2y = partial(x, 2, 2, IMQ(1; poly_deg=4)) - @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 2 - @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 2 + @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 5 + @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 5 end @testset "Gaussian" begin ∂2x = partial(x, 2, 1, Gaussian(1; poly_deg=4)) ∂2y = partial(x, 2, 2, Gaussian(1; poly_deg=4)) - @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 2 - @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 2 + @test mean_percent_error(∂2x(y), d2f_dxx.(x)) < 5 + @test mean_percent_error(∂2y(y), d2f_dyy.(x)) < 5 end end @@ -66,6 +66,6 @@ end x2 = map(x -> SVector{2}(rand(2)), 1:100) ∂x = partial(x, x2, 1, 1, PHS(3; poly_deg=2)) ∂y = partial(x, x2, 1, 2, PHS(3; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x2)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x2)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x2)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x2)) < 5 end diff --git a/test/operators/virtual.jl b/test/operators/virtual.jl index 5d0b405..079accc 100644 --- a/test/operators/virtual.jl +++ b/test/operators/virtual.jl @@ -21,22 +21,22 @@ y = f.(x) @testset "Polyharmonic Splines" begin ∂x = ∂virtual(x, 1, Δ, PHS(3; poly_deg=2)) ∂y = ∂virtual(x, 2, Δ, PHS(3; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end @testset "Inverse Multiquadrics" begin ∂x = ∂virtual(x, 1, Δ, IMQ(1; poly_deg=2)) ∂y = ∂virtual(x, 2, Δ, IMQ(1; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end @testset "Gaussian" begin ∂x = ∂virtual(x, 1, Δ, Gaussian(1; poly_deg=2)) ∂y = ∂virtual(x, 2, Δ, Gaussian(1; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x)) < 5 end end @@ -44,6 +44,6 @@ end x2 = map(x -> SVector{2}(rand(2)), 1:100) ∂x = ∂virtual(x, x2, 1, Δ, PHS(3; poly_deg=2)) ∂y = ∂virtual(x, x2, 2, Δ, PHS(3; poly_deg=2)) - @test mean_percent_error(∂x(y), df_dx.(x2)) < 2 - @test mean_percent_error(∂y(y), df_dy.(x2)) < 2 + @test mean_percent_error(∂x(y), df_dx.(x2)) < 5 + @test mean_percent_error(∂y(y), df_dy.(x2)) < 5 end