From 3a30e992cf022f4ec3c76506c070e59d093951d4 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 17 Feb 2017 19:02:52 -0500 Subject: Remove kernelparam array in favour of explicit kernel parameters This simplifies a lot of the code and will make it easier to link to other languages. --- tests/aux/test_kernel_dot_sparse.m | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/aux/test_kernel_dot_sparse.m (limited to 'tests/aux/test_kernel_dot_sparse.m') diff --git a/tests/aux/test_kernel_dot_sparse.m b/tests/aux/test_kernel_dot_sparse.m new file mode 100644 index 0000000..86a439e --- /dev/null +++ b/tests/aux/test_kernel_dot_sparse.m @@ -0,0 +1,25 @@ +#function test_kernel_dot_sparse(kerneltype) + + kerneltype = 'rbf'; + + X = [1 2 0 0 0 0; + 0 3 0 4 0 0; + 0 0 5 6 7 0; + 0 0 0 0 0 8]; + [n, m] = size(X); + spZ = sparse([ones(n, 1), X]); + + gamma = 0.05; + degree = 1.7; + const = 0.75; + + K = zeros(n, n); + if strcmp(kerneltype, 'rbf') + for i=1:n + for j=1:n + K(i, j) = exp(-gamma * sum((spZ(i, 2:end) - spZ(j, 2:end)).^2)); + end + end + end + +#end \ No newline at end of file -- cgit v1.2.3