Skip to content

Commit f7eeefe

Browse files
authored
Merge pull request #126 from JuliaGaussianProcesses/fix_maha
Replace constructor of Maha with keyword one
2 parents 7d3f47f + 6fa0bda commit f7eeefe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/basekernels/maha.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ where the matrix P is the metric.
1010
"""
1111
struct MahalanobisKernel{T<:Real, A<:AbstractMatrix{T}} <: SimpleKernel
1212
P::A
13-
function MahalanobisKernel(P::AbstractMatrix{T}) where {T<:Real}
13+
function MahalanobisKernel(; P::AbstractMatrix{T}) where {T<:Real}
1414
LinearAlgebra.checksquare(P)
1515
new{T,typeof(P)}(P)
1616
end

test/basekernels/maha.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
v2 = rand(rng, 3)
66

77
P = rand(rng, 3, 3)
8-
k = MahalanobisKernel(P)
8+
k = MahalanobisKernel(P=P)
99

1010
@test kappa(k, x) == exp(-x)
1111
@test k(v1, v2) exp(-sqmahalanobis(v1, v2, P))
1212
@test kappa(ExponentialKernel(), x) == kappa(k, x)
1313
@test repr(k) == "Mahalanobis Kernel (size(P) = $(size(P)))"
14-
# test_ADs(P -> MahalanobisKernel(P), P)
14+
# test_ADs(P -> MahalanobisKernel(P=P), P)
1515
@test_broken "Nothing passes (problem with Mahalanobis distance in Distances)"
1616
end

0 commit comments

Comments
 (0)