Changeset 36e658


Ignore:
Timestamp:
Apr 21, 2008, 2:19:25 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
2cab03a
Parents:
d48972
git-author:
Frederik Heber <heber@…> (04/18/08 15:38:00)
git-committer:
Frederik Heber <heber@…> (04/21/08 14:19:25)
Message:

CalculateConDir(): wrote Gamma calculation more compact

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pcp/src/grad.c

    rd48972 r36e658  
    624624  S[2] = PsiSP[1];
    625625  if (step) { // only in later steps is the scalar product used, but always condir stored in oldcondir and Ortho (working gradient)
    626     if (fabs(S[1]) < MYEPSILON) fprintf(stderr,"CalculateConDir: S[1] = %lg\n",S[1]);
    627     Gamma = (S[0]-S[2])/S[1];  // the final CG beta coefficient (Polak-Ribiere)
    628626    if (fabs(S[1]) < MYEPSILON) {
    629627      if (fabs((S[0]-S[2])) < MYEPSILON) 
     
    631629      else
    632630        Gamma = 0.0;
    633     }
     631    } else
     632      Gamma = (S[0]-S[2])/S[1];  // the final CG beta coefficient (Polak-Ribiere) 
    634633    if (Gamma < 0) { // Polak-Ribiere with automatic restart: gamma = max {0, gamma}
    635634      Gamma = 0.;
Note: See TracChangeset for help on using the changeset viewer.