File: minty.f

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (119 lines) | stat: -rw-r--r-- 3,029 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
      subroutine minty(coderk,ex,gamma,i1,infr,j1,la2,lp2,ma,
     &     mm,n,or,pile,piv,predw,sufval,type,u0)
      implicit integer (a-z)
      dimension lp2(*),la2(mm),or(ma),ex(ma)
      dimension type(ma),predw(n),pile(n)
      doubleprecision sufval(n),cumul,infr
      doubleprecision gamma(ma),sf,piv(n),eps
      coderk=0
      cumul=0.
      do 50 i=1,n
         predw (i)=0
         sufval(i)=infr
         pile(i)=0
 50   continue
      predw(j1)=u0
      sufval(j1)=cumul
      top=1
      bottom=0
      pile(top)=j1
 100  continue
      bottom=bottom+1
      ii=pile(bottom)
      if(lp2(ii).eq.lp2(ii+1))goto 145
      do 140 ll=lp2(ii),lp2(ii+1)-1
         u=la2(ll)
         if(ii.eq.ex(u)) goto 105
         jj=ex(u)
         if(predw(jj).gt.0) go to 140
         goto 108
 105     jj=or(u)
         if(predw(jj).gt.0) go to 140
         goto 120
 108     continue
         goto (110,115,140,115,140,115,112,110,115,140),type(u)
 110     continue
         sf=gamma(u)-piv(jj)+piv(ii)+sufval(ii)
         if(sf.ge.sufval(jj)) go to 140
         predw(jj)=-u
         sufval(jj)=sf
         go to 140
 112     continue
         sf=piv(ii)-piv(jj)+gamma(u)+sufval(ii)
         if(sf.gt.sufval(jj)) go to 140
         predw(jj)=-u
 113     sufval(jj)=sf
         go to 140
 115     continue
         top=top+1
         if(top.le.n) goto 119
         coderk=1
         return
 119     pile(top)=jj
         predw(jj)=u
         sufval(jj)=cumul
         goto 140
 120     continue
         goto (140,130,135,140,130,125,130,135,140,130),type(u)
 125     continue
         sf=piv(ii)-piv(jj)-gamma(u)+sufval(ii)
         if(sf.gt.sufval(jj)) go to 140
         predw(jj)=-u
 128     sufval(jj)=sf
         go to 140
 130     continue
         top=top+1
         if(top.le.n) goto 132
         coderk=1
         return
 132     pile(top)=jj
         predw(jj)=u
         sufval(jj)=cumul
         go to 140
 135     continue
         sf=piv(ii)-piv(jj)-gamma(u)+sufval(ii)
         if(sf.ge.sufval(jj)) go to 140
         sufval(jj)=sf
         predw(jj)=-u
         go to 140
 140  continue
 145  continue
      if(predw(i1).gt.0) goto 300
      if(bottom.ge.top) goto 200
      goto 100
 200  continue
      eps=infr
      do 240 i=1,n
         if(predw(i).ge.0)go to 240
         if(sufval(i).gt.eps)go to 240
         umin=-predw(i)
         if(type(umin).eq.6.or.type(umin).eq.7)goto 230
         if(sufval(i).ge.eps)goto 240
 230     eps=sufval(i)
         imin=i
 240  continue
      if(eps.lt.infr) goto 245
      coderk = 2
      return
 245  continue
      umin=-predw(imin)
      if(type(umin).ne.6.and.type(umin).ne.7)goto 250
      cumul=eps
      goto 300
 250  continue
      predw(imin)=-predw(imin)
      cumul=eps
      top=top+1
      if(top.le.n)goto 260
      coderk=1
      return
 260  pile(top)=imin
      go to 100
 300  continue
      do 350 i=1,n
         if(predw(i).gt.0)go to 330
         piv(i)=piv(i)+cumul
         go to 350
 330     piv(i)=piv(i)+sufval(i)
 350  continue
      end