1
1
"""
2
2
ZeroKernel()
3
3
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.
7
11
```
8
- The output type depends on `x` and `y`
12
+ The output type depends on ``x`` and ``x'``.
13
+
14
+ See also: [`ConstantKernel`](@ref)
9
15
"""
10
16
struct ZeroKernel <: SimpleKernel end
11
17
@@ -18,17 +24,21 @@ Base.show(io::IO, ::ZeroKernel) = print(io, "Zero Kernel")
18
24
"""
19
25
WhiteKernel()
20
26
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').
21
34
```
22
- κ(x,y) = δ(x,y)
23
- ```
24
- Kernel function working as an equivalent to add white noise. Can also be called via `EyeKernel()`
25
35
"""
26
36
struct WhiteKernel <: SimpleKernel end
27
37
28
38
"""
29
39
EyeKernel()
30
40
31
- See [`WhiteKernel`](@ref)
41
+ Alias of [`WhiteKernel`](@ref).
32
42
"""
33
43
const EyeKernel = WhiteKernel
34
44
@@ -39,17 +49,25 @@ metric(::WhiteKernel) = Delta()
39
49
Base. show (io:: IO , :: WhiteKernel ) = print (io, " White Kernel" )
40
50
41
51
"""
42
- ConstantKernel(; c=1.0)
52
+ ConstantKernel(; c::Real =1.0)
43
53
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.
47
61
```
62
+
63
+ See also: [`ZeroKernel`](@ref)
48
64
"""
49
65
struct ConstantKernel{Tc<: Real } <: SimpleKernel
50
66
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])
53
71
end
54
72
end
55
73
0 commit comments