@@ -16,12 +16,10 @@ See also: [`GammaExponentialKernel`](@ref)
1616"""
1717struct SqExponentialKernel{M} <: SimpleKernel
1818 metric:: M
19-
20- function SqExponentialKernel (; metric= Euclidean ())
21- return new {typeof(metric)} (metric)
22- end
2319end
2420
21+ SqExponentialKernel (; metric= Euclidean ()) = SqExponentialKernel (metric)
22+
2523kappa (:: SqExponentialKernel , d:: Real ) = exp (- d^ 2 / 2 )
2624kappa (:: SqExponentialKernel{<:Euclidean} , d²:: Real ) = exp (- d² / 2 )
2725
@@ -74,12 +72,10 @@ See also: [`GammaExponentialKernel`](@ref)
7472"""
7573struct ExponentialKernel{M} <: SimpleKernel
7674 metric:: M
77-
78- function ExponentialKernel (; metric= Euclidean ())
79- return new {typeof(metric)} (metric)
80- end
8175end
8276
77+ ExponentialKernel (; metric= Euclidean ()) = ExponentialKernel (metric)
78+
8379kappa (:: ExponentialKernel , d:: Real ) = exp (- d)
8480
8581metric (k:: ExponentialKernel ) = k. metric
@@ -129,12 +125,16 @@ struct GammaExponentialKernel{Tγ<:Real,M} <: SimpleKernel
129125 γ:: Vector{Tγ}
130126 metric:: M
131127
132- function GammaExponentialKernel (; gamma :: Real = 1.0 , γ:: Real = gamma , metric= Euclidean () )
128+ function GammaExponentialKernel (γ:: Real , metric)
133129 @check_args (GammaExponentialKernel, γ, zero (γ) < γ ≤ 2 , " γ ∈ (0, 2]" )
134130 return new {typeof(γ),typeof(metric)} ([γ], metric)
135131 end
136132end
137133
134+ function GammaExponentialKernel (; gamma:: Real = 1.0 , γ:: Real = gamma, metric= Euclidean ())
135+ return GammaExponentialKernel (γ, metric)
136+ end
137+
138138@functor GammaExponentialKernel
139139
140140kappa (κ:: GammaExponentialKernel , d:: Real ) = exp (- d^ first (κ. γ))
0 commit comments