You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CalcPHsAffinityByKatzBeta.m 890B

5 years ago
123456789101112131415161718192021222324252627282930313233343536
  1. function [ affinity ] = CalcPHsAffinityByKatzBeta( data, beta, infinity, firstPH)
  2. % sigal 29.10.13
  3. % based on CalcAffinityByKatzBeta_Sparse
  4. %sigal
  5. extraLen=0;
  6. infinity = infinity+extraLen;
  7. start_beta = beta;
  8. d_next = data;
  9. affinity = sparse(d_next .* beta);
  10. d_next = sparse(d_next);
  11. for n = 2 : infinity
  12. d_next = sparse(d_next * data);
  13. beta = beta * start_beta;
  14. affinity = sparse(affinity + (d_next .* beta));
  15. end
  16. %sigal 29.10.13 - return only PHs
  17. affinity = affinity(firstPH:end,firstPH:end);
  18. %sigal 29.10.13 - normolize by diagonal min
  19. v = diag(affinity);
  20. max_val = min(v);
  21. %max_val = max(max(affinity));
  22. affinity = affinity ./ max_val;
  23. for i = 1 : size(affinity,1)
  24. affinity(i,i) = 1;
  25. end
  26. %sigal 29.10.13 - end
  27. end %function