From 68e5d0e1e217aa6fe88b1367c052bb97a8ba1724 Mon Sep 17 00:00:00 2001 From: Christos Choutouridis Date: Sat, 2 Jan 2021 19:05:56 +0200 Subject: [PATCH] FIX: remove .m~ files from repo --- .gitignore | 3 +++ matlab/distXY.m~ | 18 ------------------ matlab/kNN.m~ | 29 ----------------------------- matlab/tail.m~ | 14 -------------- 4 files changed, 3 insertions(+), 61 deletions(-) delete mode 100644 matlab/distXY.m~ delete mode 100644 matlab/kNN.m~ delete mode 100644 matlab/tail.m~ diff --git a/.gitignore b/.gitignore index 07a920e..121639f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ bin/ out/ resources/ +# matlab +*.m~ + # hpc related # eclipse diff --git a/matlab/distXY.m~ b/matlab/distXY.m~ deleted file mode 100644 index 1295e58..0000000 --- a/matlab/distXY.m~ +++ /dev/null @@ -1,18 +0,0 @@ -function D = distXY(X, Y) -%distXY Calculate an m x n Euclidean distance matrix 𝐷 of X and Y -% -% Calculate an m x n Euclidean distance matrix 𝐷 between two sets points 𝑋 and 𝑌 of 𝑚 and 𝑛 points respectively -% X : [m x d] Corpus data points (d dimensions) -% Y : [n x d] Query data poinsts (d dimensions) -% D : [m x n] Distance matrix where D(i,j) the distance of X(i) and Y(j) - - [m d1] = size(X); - [n d2] = size(Y); - if d1 == d2 - d = d1; - else - error('Corpus(X) and Query(Y) data points have to have the same dimensions'); - end - %D = (X.*X) * ones(d,1)*ones(1,n) -2 * X*Y.' + ones(m,1)*ones(1,d) * (Y.*Y).'; - D = sum(X.^2, 2) - 2 * X*Y.' + sum(Y.^2, 2).' -end diff --git a/matlab/kNN.m~ b/matlab/kNN.m~ deleted file mode 100644 index 356ac5e..0000000 --- a/matlab/kNN.m~ +++ /dev/null @@ -1,29 +0,0 @@ -function [I, D] = kNN(X, Y, k) -%kNN return the k-nearest neighbors Of Y into dataset X -% -% Outputs: -% I : [n x k] The indexes of X where the nearest neighbors of Y lies -% D : [n x k] The distances of each neighbor -% -% Inputs: -% X : [m x d] Corpus data points (d dimensions) -% Y : [n x d] Query data points (d dimensions) -% k : [scalar] The number of neighbors - - disMat = distXY(X, Y); - [m, n] = size(disMat); - - II = repmat([1:k].', 1, n); % init the min algorithm - DD = disMat(1:k,:); - for i = k+1:m - for j = 1:n - [c, ci] = tail(DD); % calculate candidate and canditate index - if disMat(i,j) < c(j) - DD() - end - end - end - I = II.'; - D = DD.'; -end - diff --git a/matlab/tail.m~ b/matlab/tail.m~ deleted file mode 100644 index 4f65aa3..0000000 --- a/matlab/tail.m~ +++ /dev/null @@ -1,14 +0,0 @@ -function [M, I] = maxIdx(Vec) -%tail Calculate the max,index pair of each Vec(:) -% - n = length(Vec); - I = 0; - M = -1; - for j = 1:n - if M < Vec(j) - M(j) = Mat(i,j); - I(j) = i; - end - end -end -