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

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/ridge2d-bug.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/ridge2d-bug.diderot

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

revision 1562, Wed Oct 26 15:26:56 2011 UTC revision 1563, Wed Oct 26 17:57:22 2011 UTC
# Line 3  Line 3 
3  // Process output with:  // Process output with:
4  // unu jhisto -i iso2d.txt -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png  // unu jhisto -i iso2d.txt -b 512 512 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png
5    
6  int gridSize = 512;  int gridSize = 200;
7  field#2(2)[] F = bspln3 ⊛ load("../data/ddro-80.nrrd");  field#2(2)[] F = bspln3 ⊛ load("../data/ddro-80.nrrd");
8  input int stepsMax = 10;  input int stepsMax = 30;
9  real epsilon = 0.0001;  real epsilon = 0.0001;
10    
11  strand sample (int ui, int vi) {  strand sample (int ui, int vi) {
# Line 13  Line 13 
13                         lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)];                         lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)];
14      int steps = 0;      int steps = 0;
15      update {      update {
16          /*          /* */
17          if (!inside(pos, F) || steps > stepsMax) {          if (!inside(pos, F) || steps > stepsMax) {
18              die;              die;
19          }          }
20          */          /* */
21            /*
22          if (!inside(pos, F)) {          if (!inside(pos, F)) {
23              die;              die;
24          }          }
25          if (steps > stepsMax) {          if (steps >= stepsMax) {
26              stabilize;              stabilize;
27          }          }
28            */
29          vec2 grad = ∇F(pos);          vec2 grad = ∇F(pos);
30          real gmag = |grad|;          real gmag = |grad|;
31          if (gmag == 0.0) {    // can't compute step if |∇F|, so have to bail          if (gmag == 0.0) {    // can't compute step if |∇F|, so have to bail
# Line 31  Line 33 
33          }          }
34          vec2 norm = normalize(grad);          vec2 norm = normalize(grad);
35          tensor[2,2] hess = ∇⊗∇F(pos);          tensor[2,2] hess = ∇⊗∇F(pos);
36          real sdd = norm•hess•norm;          real{2} eval = evals(hess);
37          vec2 delta = (-0.001 if sdd <= 0.0 else -gmag/sdd)*norm;          vec2{2} evec = evecs(hess);
38            real fdd = grad•evec{1};
39            real sdd = evec{1}•hess•evec{1};
40            vec2 delta = (0.001 if sdd >= 0.0 else -fdd/sdd)*evec{1};
41          if (|delta| < epsilon) {    // we've converged if step is small enough          if (|delta| < epsilon) {    // we've converged if step is small enough
42                if (eval{1} < -10000.0) {
43              stabilize;              stabilize;
44                } else {
45                   die;
46                }
47          }          }
48          pos += delta;          pos += delta;
49          steps += 1;          steps += 1;
# Line 43  Line 52 
52    
53  initially { sample(ui, vi) | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };  initially { sample(ui, vi) | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };
54    
 /*  
 ridge2d.c:140:22: warning: implicit declaration of function 'mulVec2Mat2x2f' is invalid in C99  
       [-Wimplicit-function-declaration]  
     l_sdd_39 = dot2f(mulVec2Mat2x2f(l_norm_33, l_hess_38), l_norm_33);  
                      ^  
 ridge2d.c:140:22: error: passing 'int' to parameter of incompatible type 'vec2f_t'  
     l_sdd_39 = dot2f(mulVec2Mat2x2f(l_norm_33, l_hess_38), l_norm_33);  
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
 /Users/gk/diderot/diderot/branches/pure-cfg/src/include/Diderot/inline-vec2.h:95:36: note: passing argument  
       to parameter 'u' here  
 STATIC_INLINE float dot2f (vec2f_t u, vec2f_t v)  
                                    ^  
 1 warning and 1 error generated.  
   
 *** BACK-TRACE ***  
 GOTO   common/phase-timer.sml:74.9-80.7: PhaseTimer.withTimer[2]  
           (from: ???)  
 GOTO   driver/main.sml:68.81-92.7: Main.doFile[2]  
           (from: driver/main.sml:68.62-92.8: Main.doFile[2])  
 CALL   driver/main.sml:68.9-92.8: Main.doFile[2]  
           (from: common/phase-timer.sml:76.13-76.16: PhaseTimer.withTimer[2].y)  
   
 c-util/run-cc.sml:23.17-23.47: Fail: error compiling/linking  
   
 uncaught exception Fail [Fail: error compiling/linking]  
   raised at common/phase-timer.sml:76.50-76.52  
   raised at trace-debug-profile/back-trace.sml:207.12  
   raised at common/phase-timer.sml:76.50-76.52  
   raised at common/phase-timer.sml:76.50-76.52  
   raised at c-util/run-cc.sml:23.17-23.47  
 */  

Legend:
Removed from v.1562  
changed lines
  Added in v.1563

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