Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve Float type for Periodic Kernel #560

Merged
merged 5 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/basekernels/periodic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

metric(κ::PeriodicKernel) = Sinus(κ.r)

kappa(::PeriodicKernel, d::Real) = exp(-0.5d)
kappa(::PeriodicKernel, d::Real) = exp(-d / 2)

Check warning on line 37 in src/basekernels/periodic.jl

View check run for this annotation

Codecov / codecov/patch

src/basekernels/periodic.jl#L37

Added line #L37 was not covered by tests

function Base.show(io::IO, κ::PeriodicKernel)
return print(io, "Periodic Kernel, length(r) = $(length(κ.r))")
Expand Down
1 change: 1 addition & 0 deletions test/basekernels/periodic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
molet marked this conversation as resolved.
Show resolved Hide resolved
@test repr(k) == "Periodic Kernel, length(r) = $(length(r))"

# Standardised tests.
Expand Down
Loading