From aae8bc2f6ffa0abd8ce667acca1cb94e60daeffd Mon Sep 17 00:00:00 2001 From: Letif Mones Date: Mon, 8 Jul 2024 10:18:06 +0100 Subject: [PATCH 1/4] 0.5d -> d/2 change for kappa function of periodic kernel --- Project.toml | 2 +- src/basekernels/periodic.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 24da5ddcc..249f032ec 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "KernelFunctions" uuid = "ec8451be-7e33-11e9-00cf-bbf324bd1392" -version = "0.10.63" +version = "0.10.64" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" diff --git a/src/basekernels/periodic.jl b/src/basekernels/periodic.jl index 2758d7f94..aeadf5e5a 100644 --- a/src/basekernels/periodic.jl +++ b/src/basekernels/periodic.jl @@ -34,7 +34,7 @@ PeriodicKernel(T::DataType, dims::Int=1) = PeriodicKernel(; r=ones(T, dims)) metric(κ::PeriodicKernel) = Sinus(κ.r) -kappa(::PeriodicKernel, d::Real) = exp(-0.5d) +kappa(::PeriodicKernel, d::Real) = exp(-d / 2) function Base.show(io::IO, κ::PeriodicKernel) return print(io, "Periodic Kernel, length(r) = $(length(κ.r))") From 1416dd2241764aa2c5942e7ccdb30fe9dd4034a0 Mon Sep 17 00:00:00 2001 From: Letif Mones Date: Mon, 8 Jul 2024 13:10:21 +0100 Subject: [PATCH 2/4] test added --- test/basekernels/periodic.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/basekernels/periodic.jl b/test/basekernels/periodic.jl index 540947b1b..056327ff2 100644 --- a/test/basekernels/periodic.jl +++ b/test/basekernels/periodic.jl @@ -8,6 +8,7 @@ @test k(v1, v2) ≈ exp(-0.5 * sum(abs2, sinpi.(v1 - v2) ./ r)) @test k(v1, v2) == k(v2, v1) @test PeriodicKernel(3)(v1, v2) == PeriodicKernel(; r=ones(3))(v1, v2) + @test isa(PeriodicKernel(r=Float32.(r))(Float32.(v1), Float32.(v2)), Float32) @test repr(k) == "Periodic Kernel, length(r) = $(length(r))" # Standardised tests. From 8686dd1807d8b2906ecf024d14ad894bae8d6df9 Mon Sep 17 00:00:00 2001 From: Letif Mones Date: Mon, 8 Jul 2024 13:19:20 +0100 Subject: [PATCH 3/4] strip trailing whitespace --- test/basekernels/periodic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/basekernels/periodic.jl b/test/basekernels/periodic.jl index 056327ff2..fae266da5 100644 --- a/test/basekernels/periodic.jl +++ b/test/basekernels/periodic.jl @@ -8,7 +8,7 @@ @test k(v1, v2) ≈ exp(-0.5 * sum(abs2, sinpi.(v1 - v2) ./ r)) @test k(v1, v2) == k(v2, v1) @test PeriodicKernel(3)(v1, v2) == PeriodicKernel(; r=ones(3))(v1, v2) - @test isa(PeriodicKernel(r=Float32.(r))(Float32.(v1), Float32.(v2)), Float32) + @test isa(PeriodicKernel(r=Float32.(r))(Float32.(v1), Float32.(v2)), Float32) @test repr(k) == "Periodic Kernel, length(r) = $(length(r))" # Standardised tests. From d84ec691091b36dec184e51cc339daf2bef3fcfd Mon Sep 17 00:00:00 2001 From: Letif Mones Date: Mon, 8 Jul 2024 13:43:52 +0100 Subject: [PATCH 4/4] Update test/basekernels/periodic.jl Co-authored-by: David Widmann --- test/basekernels/periodic.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/basekernels/periodic.jl b/test/basekernels/periodic.jl index fae266da5..c33569714 100644 --- a/test/basekernels/periodic.jl +++ b/test/basekernels/periodic.jl @@ -8,7 +8,7 @@ @test k(v1, v2) ≈ exp(-0.5 * sum(abs2, sinpi.(v1 - v2) ./ r)) @test k(v1, v2) == k(v2, v1) @test PeriodicKernel(3)(v1, v2) == PeriodicKernel(; r=ones(3))(v1, v2) - @test isa(PeriodicKernel(r=Float32.(r))(Float32.(v1), Float32.(v2)), Float32) + @test PeriodicKernel(; r=Float32.(r))(Float32.(v1), Float32.(v2)) isa Float32 @test repr(k) == "Periodic Kernel, length(r) = $(length(r))" # Standardised tests.