Skip to content

Commit 0b9fdbf

Browse files
committed
Add tests for nystrom.jl
1 parent eeaf1c6 commit 0b9fdbf

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using Random
55

66
@testset "KernelFunctions" begin
77
include("test_kernelmatrix.jl")
8+
include("test_approximations.jl")
89
include("test_constructors.jl")
910
# include("test_AD.jl")
1011
include("test_transform.jl")

test/test_approximations.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Distances, LinearAlgebra
2+
using Test
3+
using KernelFunctions
4+
5+
dims = [10,5]
6+
X = rand(dims...)
7+
k = SqExponentialKernel()
8+
@testset "Kernel Matrix Approximations" begin
9+
@testset "Nystrom" begin
10+
for obsdim in [1, 2]
11+
@test kernelmatrix(k, X; obsdim=obsdim) kernelmatrix(nystrom(k, X, 1.0; obsdim=obsdim))
12+
@test kernelmatrix(k, X; obsdim=obsdim) kernelmatrix(nystrom(k, X, collect(1:dims[obsdim]); obsdim=obsdim))
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)