11 lines
447 B
Matlab
11 lines
447 B
Matlab
function [N, D] = mergeReducedResultsWithMink(N_sub, D_sub, C_sub, k, ~)
|
|
% Merge reduced results for one subset of queries using mink
|
|
numQueries = size(N_sub, 1); % Number of queries
|
|
|
|
% Find the k smallest distances and their indices using mink
|
|
[D, idx] = mink(D_sub, k, 2);
|
|
|
|
% Select the corresponding neighbors based on the indices
|
|
N = N_sub(sub2ind(size(N_sub), ...
|
|
repmat((1:numQueries)', 1, k), idx));
|
|
end |