One important rule of thumb is to lower the length parameter! So that the kernel function is peaky! kdpp_fast utilizes matrix inversion lemma and computing the inverse of a kernel matrix might be numerically unstable if the kernel function is smooth.
Result
code: main
%%
clc; clear all; close all;
%% Y를 만들자.
N = 1E4;
Y = zeros(N, 2);
xmax = 10;
ymax = 10;
for i = 1:N
Y(i, :) = [xmax*rand ymax*rand];
end
%% DPP와 unif로 뽑아보자.
k = 1000;
kfun = @(X1, X2)(kernel_se(X1, X2));
fprintf('Starting kdpp where k is %d. \n', k);
tic;
kdpp_struct = kdpp(Y, kfun, k);
toc1 = toc;
fprintf('Starting kdpp_fast where k is %d. \n', k);