@@ -6,20 +6,14 @@ using KernelFunctions
66using Random
77using Test
88
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-
159"""
1610 test_interface(
1711 k::Kernel,
1812 x0::AbstractVector,
1913 x1::AbstractVector,
2014 x2::AbstractVector;
21- atol=__ATOL ,
22- rtol=__RTOL ,
15+ rtol=1e-6 ,
16+ atol=rtol ,
2317 )
2418
2519Run various consistency checks on `k` at the inputs `x0`, `x1`, and `x2`.
@@ -29,22 +23,14 @@ be of different lengths.
2923These tests are intended to pick up on really substantial issues with a kernel implementation
3024(e.g. substantial asymmetry in the kernel matrix, large negative eigenvalues), rather than to
3125test 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.
4026"""
4127function test_interface (
4228 k:: Kernel ,
4329 x0:: AbstractVector ,
4430 x1:: AbstractVector ,
4531 x2:: AbstractVector ;
46- atol = __ATOL ,
47- rtol = __RTOL ,
32+ rtol = 1e-6 ,
33+ atol = rtol ,
4834)
4935 # Ensure that we have the required inputs.
5036 @assert length (x0) == length (x1)
@@ -160,7 +146,16 @@ function test_interface(k::Kernel, T::Type{<:AbstractVector}; kwargs...)
160146 return test_interface (Random. GLOBAL_RNG, k, T; kwargs... )
161147end
162148
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 }
164159 @testset " Vector{$T }" begin
165160 test_interface (rng, k, Vector{T}; kwargs... )
166161 end
0 commit comments