Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/staging/test/iso2d.diderot
ViewVC logotype

Diff of /branches/staging/test/iso2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1169, Tue May 10 13:36:45 2011 UTC revision 1329, Mon Jun 13 00:11:39 2011 UTC
# Line 25  Line 25 
25          if (!inside(pos, F) || steps > stepsMax) {          if (!inside(pos, F) || steps > stepsMax) {
26              die;              die;
27          }          }
28            // GLKs recent changes (revision 1329) were made to make the code
29            // a more obvious implementation of Newton-Raphson, and also to create
30            // some obvious and not-so-obvious opportunties for optimization
31          vec2 grad = ∇F(pos);          vec2 grad = ∇F(pos);
32          real gmsq = grad • grad;          if (|grad| == 0.0) {    // can't compute step if |∇F|, so have to bail
         // If |∇F|=0 we can't compute update; we have to bail  
         if (gmsq == 0.0) {  
33              die;              die;
34          }          }
35          // delta = Newton-Raphson step          vec2 norm = normalize(grad);
36          vec2 delta = -(F(pos) - isoval)*grad/gmsq;          vec2 delta = -((F(pos) - isoval)/|grad|)*norm;  // Newton-Raphson step
37          // We've converged if the update is small enough          if (|delta| < epsilon) {    // we've converged if step is small enough
         if (|delta| < epsilon) {  
38              stabilize;              stabilize;
39          }          }
40          pos = pos + delta;          pos += delta;
41          steps = steps + 1;          steps += 1;
42      }      }
43  }  }
44    

Legend:
Removed from v.1169  
changed lines
  Added in v.1329

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0