20
20
function (κ:: FBMKernel )(x:: AbstractVector{<:Real} , y:: AbstractVector{<:Real} )
21
21
modX = sum (abs2, x)
22
22
modY = sum (abs2, y)
23
- modXY = evaluate ( SqEuclidean (sqroundoff), x, y)
23
+ modXY = sqeuclidean ( x, y)
24
24
h = first (κ. h)
25
25
return (modX^ h + modY^ h - modXY^ h)/ 2
26
26
end
29
29
30
30
Base. show (io:: IO , κ:: FBMKernel ) = print (io, " Fractional Brownian Motion Kernel (h = " , first (κ. h), " )" )
31
31
32
- const sqroundoff = 1e-15
33
-
34
32
_fbm (modX, modY, modXY, h) = (modX^ h + modY^ h - modXY^ h)/ 2
35
33
36
34
_mod (x:: AbstractVector{<:Real} ) = abs2 .(x)
@@ -39,19 +37,19 @@ _mod(x::RowVecs) = vec(sum(abs2, x.X; dims=2))
39
37
40
38
function kernelmatrix (κ:: FBMKernel , x:: AbstractVector )
41
39
modx = _mod (x)
42
- modxx = pairwise (SqEuclidean (sqroundoff ), x)
40
+ modxx = pairwise (SqEuclidean (), x)
43
41
return _fbm .(modx, modx' , modxx, κ. h)
44
42
end
45
43
46
44
function kernelmatrix! (K:: AbstractMatrix , κ:: FBMKernel , x:: AbstractVector )
47
45
modx = _mod (x)
48
- pairwise! (K, SqEuclidean (sqroundoff ), x)
46
+ pairwise! (K, SqEuclidean (), x)
49
47
K .= _fbm .(modx, modx' , K, κ. h)
50
48
return K
51
49
end
52
50
53
51
function kernelmatrix (κ:: FBMKernel , x:: AbstractVector , y:: AbstractVector )
54
- modxy = pairwise (SqEuclidean (sqroundoff ), x, y)
52
+ modxy = pairwise (SqEuclidean (), x, y)
55
53
return _fbm .(_mod (x), _mod (y)' , modxy, κ. h)
56
54
end
57
55
@@ -61,7 +59,7 @@ function kernelmatrix!(
61
59
x:: AbstractVector ,
62
60
y:: AbstractVector ,
63
61
)
64
- pairwise! (K, SqEuclidean (sqroundoff ), x, y)
62
+ pairwise! (K, SqEuclidean (), x, y)
65
63
K .= _fbm .(_mod (x), _mod (y)' , K, κ. h)
66
64
return K
67
65
end
0 commit comments