Skip to content

Commit 9775bf5

Browse files
authored
Fix default degree of PiecewisePolynomialKernel (#229)
1 parent 591b979 commit 9775bf5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "KernelFunctions"
22
uuid = "ec8451be-7e33-11e9-00cf-bbf324bd1392"
3-
version = "0.8.14"
3+
version = "0.8.15"
44

55
[deps]
66
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"

src/basekernels/piecewisepolynomial.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ struct PiecewisePolynomialKernel{D,C<:Tuple} <: SimpleKernel
4141
end
4242

4343
# TODO: remove `maha` keyword argument in next breaking release
44-
function PiecewisePolynomialKernel(; v::Int=-1, degree::Int=v, maha=nothing, dim::Int=-1)
44+
function PiecewisePolynomialKernel(; v::Int=-1, degree::Int=0, maha=nothing, dim::Int=-1)
4545
if v != -1
4646
Base.depwarn(
4747
"keyword argument `v` is deprecated, use `degree` instead",
4848
:PiecewisePolynomialKernel,
4949
)
50+
degree = v
5051
end
5152

5253
if maha !== nothing

test/basekernels/piecewisepolynomial.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
@test_throws ErrorException PiecewisePolynomialKernel{4}(maha)
2222
@test_throws ErrorException PiecewisePolynomialKernel{4}(D)
2323
@test_throws ErrorException PiecewisePolynomialKernel{degree}(-1)
24+
@test_throws ErrorException PiecewisePolynomialKernel()
25+
@test_throws ErrorException PiecewisePolynomialKernel(; degree=degree)
26+
27+
# default degree
28+
@test PiecewisePolynomialKernel(; dim=D) isa PiecewisePolynomialKernel{0}
2429

2530
@test repr(k) ==
2631
"Piecewise Polynomial Kernel (degree = $(degree), ⌊dim/2⌋ = $(div(D, 2)))"

0 commit comments

Comments
 (0)