From 05d7d4fb0f72ba51864230a9b2e73429266c82a2 Mon Sep 17 00:00:00 2001 From: joannajzou Date: Wed, 6 Dec 2023 10:35:57 -0500 Subject: [PATCH 1/3] new branch for refactoring kernel calculation --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 83de1e85..24d79df6 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ docs/src/generated/ # data too large for github examples/aHfO2/ +*.xyz +*.csv From ba1c5073c3f0c4f6389c7967eda75612c321562c Mon Sep 17 00:00:00 2001 From: joannajzou Date: Wed, 6 Dec 2023 10:44:02 -0500 Subject: [PATCH 2/3] make symmetric kernel computation more efficient Small change which reduces the cost of computing symmetric kernels. One half of the matrix terms [Kij] are computed, then copied over to [Kji]. --- src/Kernels/kernels.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Kernels/kernels.jl b/src/Kernels/kernels.jl index 681ff269..e597498a 100644 --- a/src/Kernels/kernels.jl +++ b/src/Kernels/kernels.jl @@ -89,8 +89,10 @@ function KernelMatrix( n = length(F) K = zeros(n, n) for i = 1:n - for j = 1:n - K[i, j] = compute_kernel(F[i], F[j], k) + for j = i:n + Kij = compute_kernel(F[i], F[j], k) + K[i, j] = Kij + K[j, i] = Kij end end Symmetric(K) From 646f12dbf315a0b09383a74ca1cbd3adee70fffd Mon Sep 17 00:00:00 2001 From: joannajzou Date: Wed, 6 Dec 2023 11:16:03 -0500 Subject: [PATCH 3/3] use Symmetric() function --- src/Kernels/kernels.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Kernels/kernels.jl b/src/Kernels/kernels.jl index e597498a..c7414aa9 100644 --- a/src/Kernels/kernels.jl +++ b/src/Kernels/kernels.jl @@ -90,9 +90,7 @@ function KernelMatrix( K = zeros(n, n) for i = 1:n for j = i:n - Kij = compute_kernel(F[i], F[j], k) - K[i, j] = Kij - K[j, i] = Kij + K[i, j] = compute_kernel(F[i], F[j], k) end end Symmetric(K)