@@ -6,20 +6,14 @@ using KernelFunctions
6
6
using Random
7
7
using Test
8
8
9
- # default tolerance values for test_interface:
10
- const __ATOL = sqrt (eps (Float64))
11
- const __RTOL = sqrt (eps (Float64))
12
- # ≈ 1.5e-8; chosen for no particular reason other than because it seems to
13
- # satisfy our own test cases within KernelFunctions.jl
14
-
15
9
"""
16
10
test_interface(
17
11
k::Kernel,
18
12
x0::AbstractVector,
19
13
x1::AbstractVector,
20
14
x2::AbstractVector;
21
- atol=__ATOL ,
22
- rtol=__RTOL ,
15
+ rtol=1e-6 ,
16
+ atol=rtol ,
23
17
)
24
18
25
19
Run various consistency checks on `k` at the inputs `x0`, `x1`, and `x2`.
@@ -29,22 +23,14 @@ be of different lengths.
29
23
These tests are intended to pick up on really substantial issues with a kernel implementation
30
24
(e.g. substantial asymmetry in the kernel matrix, large negative eigenvalues), rather than to
31
25
test the numerics in detail, which can be kernel-specific.
32
- The default value of `__ATOL` and `__RTOL` is `sqrt(eps(Float64)) ≈ 1.5e-8`, which satisfied
33
- this intention in the cases tested within KernelFunctions.jl itself.
34
-
35
- test_interface([rng::AbstractRNG], k::Kernel, T::Type{<:Real}; atol=__ATOL, rtol=__RTOL)
36
-
37
- `test_interface` offers automated test data generation for kernels whose inputs are reals.
38
- This will run the tests for `Vector{T}`, `Vector{Vector{T}}`, `ColVecs{T}`, and `RowVecs{T}`.
39
- For other input vector types, please provide the data manually.
40
26
"""
41
27
function test_interface (
42
28
k:: Kernel ,
43
29
x0:: AbstractVector ,
44
30
x1:: AbstractVector ,
45
31
x2:: AbstractVector ;
46
- atol = __ATOL ,
47
- rtol = __RTOL ,
32
+ rtol = 1e-6 ,
33
+ atol = rtol ,
48
34
)
49
35
# Ensure that we have the required inputs.
50
36
@assert length (x0) == length (x1)
@@ -160,7 +146,16 @@ function test_interface(k::Kernel, T::Type{<:AbstractVector}; kwargs...)
160
146
return test_interface (Random. GLOBAL_RNG, k, T; kwargs... )
161
147
end
162
148
163
- function test_interface (rng:: AbstractRNG , k:: Kernel , T:: Type{<:Real} ; kwargs... )
149
+ """
150
+ test_interface([rng::AbstractRNG], k::Kernel, ::Type{T}; kwargs...) where {T<:Real}
151
+
152
+ Run the [`test_interface`](@ref) tests for randomly generated inputs of types `Vector{T}`, `Vector{Vector{T}}`, `ColVecs{T}`, and `RowVecs{T}`.
153
+
154
+ For other input types, please provide the data manually.
155
+
156
+ The keyword arguments are forwarded to the invocations of [`test_interface`](@ref) with the randomly generated inputs.
157
+ """
158
+ function test_interface (rng:: AbstractRNG , k:: Kernel , :: Type{T} ; kwargs... ) where {T<: Real }
164
159
@testset " Vector{$T }" begin
165
160
test_interface (rng, k, Vector{T}; kwargs... )
166
161
end
0 commit comments