Skip to content

Commit 5ddf568

Browse files
committed
Made corrections for piecewise
1 parent 64d0753 commit 5ddf568

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/basekernels/piecewisepolynomial.jl

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ where `r` is the Mahalanobis distance mahalanobis(x,y) with `maha` as the metric
1212
"""
1313
struct PiecewisePolynomialKernel{V, A<:AbstractMatrix{<:Real}} <: SimpleKernel
1414
maha::A
15-
j::Int64
15+
j::Int
1616
function PiecewisePolynomialKernel{V}(maha::AbstractMatrix{<:Real}) where V
1717
V in (0, 1, 2, 3) || error("Invalid paramter v=$(V). Should be 0, 1, 2 or 3.")
1818
LinearAlgebra.checksquare(maha)
@@ -31,11 +31,7 @@ _f(κ::PiecewisePolynomialKernel{2}, r, j) = 1 + (j + 2) * r + (j^2 + 4 * j + 3)
3131
_f::PiecewisePolynomialKernel{3}, r, j) = 1 + (j + 3) * r +
3232
(6 * j^2 + 36j + 45) / 15 * r.^2 + (j^3 + 9 * j^2 + 23j + 15) / 15 * r.^3
3333

34-
function _piecewisepolynomial::PiecewisePolynomialKernel{V}, r, j) where V
35-
return max(1 - r, 0)^(j + V) * _f(κ, r, j)
36-
end
37-
38-
kappa::PiecewisePolynomialKernel, d::Real) = _piecewisepolynomial(κ, r, κ.j)
34+
kappa::PiecewisePolynomialKernel{V}, r) where V = max(1 - r, 0)^.j + V) * _f(κ, r, κ.j)
3935

4036
metric::PiecewisePolynomialKernel) = Mahalanobis.maha)
4137

0 commit comments

Comments
 (0)