Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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.29"
version = "0.10.30"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
8 changes: 8 additions & 0 deletions src/basekernels/constant.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ kappa(κ::ConstantKernel, x::Real) = only(κ.c) * one(x)

metric(::ConstantKernel) = Delta()

function kernelmatrix(k::ConstantKernel, x::AbstractVector)
return Fill(only(k.c), length(x), length(x))
end

function kernelmatrix(k::ConstantKernel, x::AbstractVector, y::AbstractVector)
return Fill(only(k.c), length(x), length(y))
end

Base.show(io::IO, κ::ConstantKernel) = print(io, "Constant Kernel (c = ", only(κ.c), ")")