A V0 implementation tested against matlab

Supports:
 - HDF5 file load and store
 - Precision timing of the process to stdout
 - logging (verbose mode) to stdout
 - Command line arguments and help
This commit is contained in:
2024-11-18 00:29:04 +02:00
parent 7c88260900
commit f591127e16
11 changed files with 1357 additions and 99 deletions
+2
View File
@@ -0,0 +1,2 @@
# matlab
*.m~
+5 -3
View File
@@ -1,10 +1,12 @@
function [D2] = dist2(X, Y)
% Calculates the squares of the distances of X and Y
%
% X: A mxd array with m d-dimentional points
% Y: A nxd array with n d-dimentional points
% X: A Mxd array with m d-dimentional points
% Y: A Nxd array with n d-dimentional points
% d: Must be the same
%
% D2: The MxN matrix with the distances
%
[~, d1] = size(X);
[~, d2] = size(Y);
if d1 ~= d2
+8 -4
View File
@@ -1,8 +1,12 @@
function [idx, dst] = knnsearch2(C, Q, k)
% C: Is a mxd matrix (Corpus)
% Q: Is a nxd matrix (Query)
% k: The number of nearest neighbors needded
% C: Is a MxD matrix (Corpus)
% Q: Is a NxD matrix (Query)
% k: The number of nearest neighbors needded
% idx: Is the Nxk matrix with the k indexes of the C points, that are
% neighbors of the nth point of Q
% dst: Is the Nxk matrix with the k distances to the C points of the nth
% point of Q
%
% Calculate the distance matrix between C and Q
% D is an m x n matrix where each element D(i, j) is the distance
% between the i-th point in C and the j-th point in Q.