Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. double convergance = 1;
  2.  
  3. //Preset first term of equation
  4. double damp = dampener;
  5. double firstTerm = (1 - damp)/npages;
  6.  
  7. //Set all initial scores
  8. double fScore = 1.0 / (double) npages;
  9.  
  10. double* scores;
  11. scores = (double*)calloc(npages, sizeof(pageScore));
  12. double* prevScores;
  13. prevScores = (double*)calloc(npages, sizeof(pageScore));
  14.  
  15. int i;
  16.  
  17. for (i = 0; i < npages; i++) {
  18. scores[i]->score = fScore;
  19. prevScores[i]->score = fScore;
  20. }
  21.  
  22. list* pages = plist;
  23.  
  24.  
  25. //formula
  26. while (convergance > 0.05) {
  27. //Set Pn-1 scores to Pn
  28. for (i = 0; i < npages; i++) {
  29. prevScores[i] = scores[i];
  30. }
  31.  
  32. //Calculate new values
  33. for (i = 0; i < npages; i++) {
  34.  
  35. }
  36.  
  37.  
  38.  
  39. //Calculate convergence value
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement