Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

Quantization.m 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. %% Clusters Distance
  2. % The function provides the computation of Euclidean Distance
  3. % Between Clusters and input Data Matrices.
  4. % If the flag CMinDistON is active, it returns the Cluster Matrix
  5. % corresponding to input Data which are minimum at distance.
  6. %
  7. % Inputs:
  8. % - XSet Input Matrix: each row is a multidimensional data
  9. % - CSet Cluster Matrix: each row is a multidimensional data
  10. % - CMinDistON Flag which allows to return the Minimum Distance Clusters
  11. %
  12. % Outputs:
  13. % - XCDist Matrix containing the Distances between Data and Clusters
  14. % - CMinDist Matrix containing the Clusters at Minimum Distance
  15. %%
  16. function [ CMinDist, iCMinDist] = Quantization( XSet, CSet)
  17. % Ntr = size(XSet,2);
  18. % imgSzSq=size(CSet,1);
  19. % kCent = size(CSet,2);
  20. %
  21. % XCDist=zeros(kCent,Ntr);
  22. % CMinDist=zeros(imgSzSq,Ntr);
  23. % iCMinDist=zeros(1,Ntr);
  24. %
  25. % for jj=1:Ntr
  26. % for ii=1:kCent
  27. % XCDist(ii,jj)=sqrt(sum((XSet(:,jj)-CSet(:,ii)).^2));
  28. % end
  29. % [~,iCMinDist(jj)]=min(XCDist(:,jj));
  30. % CMinDist(:,jj)=CSet(:,iCMinDist(jj));
  31. % end
  32. CSetSq = sum (CSet.^2) / 2;
  33. XSetSq = sum (XSet.^2) / 2;
  34. XCDist = bsxfun (@plus, XSetSq', bsxfun (@minus, CSetSq, XSet'*CSet));
  35. % if nRecall == 1
  36. [CMinDist, iCMinDist] = min (XCDist, [], 2);
  37. % else
  38. % [CMinDist, iCMinDist] = sort (XCDist, 2);
  39. % CMinDist = CMinDist (:, 1:nRecall);
  40. % iCMinDist = iCMinDist (:, 1:nRecall);
  41. % end
  42. % CMinDist = CMinDist' * 2;
  43. % iCMinDist = iCMinDist';
  44. end