11"""
22 ZeroKernel()
33
4- Create a kernel that always returns zero
5- ```
6- κ(x,y) = 0.0
4+ Zero kernel.
5+
6+ # Definition
7+
8+ For inputs ``x, x'``, the zero kernel is defined as
9+ ```math
10+ k(x, x') = 0.
711```
8- The output type depends on `x` and `y`
12+ The output type depends on ``x`` and ``x'``.
13+
14+ See also: [`ConstantKernel`](@ref)
915"""
1016struct ZeroKernel <: SimpleKernel end
1117
@@ -18,17 +24,21 @@ Base.show(io::IO, ::ZeroKernel) = print(io, "Zero Kernel")
1824"""
1925 WhiteKernel()
2026
27+ White noise kernel.
28+
29+ # Definition
30+
31+ For inputs ``x, x'``, the white noise kernel is defined as
32+ ```math
33+ k(x, x') = \\ delta(x, x').
2134```
22- κ(x,y) = δ(x,y)
23- ```
24- Kernel function working as an equivalent to add white noise. Can also be called via `EyeKernel()`
2535"""
2636struct WhiteKernel <: SimpleKernel end
2737
2838"""
2939 EyeKernel()
3040
31- See [`WhiteKernel`](@ref)
41+ Alias of [`WhiteKernel`](@ref).
3242"""
3343const EyeKernel = WhiteKernel
3444
@@ -39,17 +49,25 @@ metric(::WhiteKernel) = Delta()
3949Base. show (io:: IO , :: WhiteKernel ) = print (io, " White Kernel" )
4050
4151"""
42- ConstantKernel(; c=1.0)
52+ ConstantKernel(; c::Real =1.0)
4353
44- Kernel function always returning a constant value `c`
45- ```
46- κ(x,y) = c
54+ Kernel of constant value `c`.
55+
56+ # Definition
57+
58+ For inputs ``x, x'``, the kernel of constant value ``c \\ geq 0`` is defined as
59+ ```math
60+ k(x, x') = c.
4761```
62+
63+ See also: [`ZeroKernel`](@ref)
4864"""
4965struct ConstantKernel{Tc<: Real } <: SimpleKernel
5066 c:: Vector{Tc}
51- function ConstantKernel (; c:: T = 1.0 ) where {T<: Real }
52- return new {T} ([c])
67+
68+ function ConstantKernel (; c:: Real = 1.0 )
69+ @check_args (ConstantKernel, c, c >= zero (c), " c ≥ 0" )
70+ return new {typeof(c)} ([c])
5371 end
5472end
5573
0 commit comments