Télécharger levmar.eso

Retour à la liste

Numérotation des lignes :

levmar
  1. C LEVMAR SOURCE KICH 16/07/12 21:15:04 9027
  2. SUBROUTINE LEVMAR
  3. *
  4. * moteur pour algorithme levenberg-marquardt
  5. *
  6. IMPLICIT INTEGER(I-N)
  7. IMPLICIT REAL*8(A-H,O-Z)
  8.  
  9. -INC PPARAM
  10. -INC CCOPTIO
  11. -INC CCREEL
  12. -INC SMLENTI
  13. -INC SMLREEL
  14. SEGMENT MLREE4.MLREEL,MLREE5.MLREEL,MLREE6.MLREEL,MLREE8.MLREEL,
  15. + MLREE9.MLREEL,MLRE11.MLREEL,MLRE12.MLREEL,MLRE13.MLREEL
  16.  
  17. PARAMETER (NTYP=11,NPRO = 10)
  18. CHARACTER*4 LISTYP(NTYP)
  19. integer iprocm(NPRO,2)
  20. real*8 xmordo(NPRO)
  21. logical dpro
  22. DATA LISTYP / 'ABSC', 'ORDO', 'PARA', 'TORD', 'DYDA',
  23. & 'SIGM', 'PROC', 'ALPH', 'BETA', 'CHI2',
  24. & 'PARO' /
  25.  
  26. data iprocm/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/
  27. SAVE iprocm
  28. data xmordo/1.D0,1.D0,1.D0,1.D0,1.D0,1.D0,1.D0,1.D0,1.D0,1.D0/
  29. SAVE xmordo
  30. c
  31. dpro =.true.
  32. lapro = 0
  33. c
  34. jg = NTYP
  35. segini mlenti
  36. c
  37. call LIROBJ('LISTREEL',ip1,0,iret)
  38. IF (IERR.NE.0) GOTO 900
  39. if(iret.eq.1) then
  40. lect(4) = ip1
  41. call LIROBJ('LISTREEL',ip1,1,iret)
  42. IF (IERR.NE.0) GOTO 900
  43. lect(5) = ip1
  44. endif
  45. c
  46. idon = 0
  47.  
  48. 10 continue
  49. CALL LIRMOT(LISTYP,NTYP,iplac,0)
  50. IF (IERR.NE.0) GOTO 900
  51. if (iplac.gt.0) then
  52. if (iplac.ne.7) then
  53. call LIROBJ('LISTREEL',ip1,1,iret)
  54. else if (iplac.eq.7) then
  55. call LIROBJ('PROCEDUR',ip1,1,iret)
  56. do kpro = 1,NPRO
  57. if (iprocm(kpro,1).eq.ip1) then
  58. iprocc = iprocm(kpro,2)
  59. lapro = kpro
  60. dpro = .false.
  61. endif
  62. if (iprocm(kpro,1).eq.0.and.dpro) then
  63. iprocm(kpro,1) = ip1
  64. iprocc = 0
  65. lapro = kpro
  66. dpro = .false.
  67. endif
  68. enddo
  69. endif
  70. IF (IERR.NE.0) GOTO 900
  71. lect(iplac) = ip1
  72. idon = idon + 1
  73. goto 10
  74. endif
  75.  
  76.  
  77.  
  78. if (iprocc.eq.0) then
  79. if (lect(7).le.0) then
  80. moterr(1:8) ='PROCEDUR'
  81. call erreur(37)
  82. GOTO 900
  83. endif
  84. mlree1 = lect(1)
  85. mlree2 = lect(2)
  86. mlree6 = lect(6)
  87. mlree3 = lect(3)
  88. if (mlree1.le.0 .or. mlree2.le.0 .or. mlree6.le.0 .or.
  89. & mlree3.le.0) then
  90. call erreur(201)
  91. GOTO 900
  92. endif
  93. segact,mlree1,mlree2,mlree6
  94. n1 = mlree1.prog(/1)
  95. n2 = mlree2.prog(/1)
  96. n6 = mlree6.prog(/1)
  97. if (n1.LE.0 .or. n1.NE.n2 .or. n1.NE.n6 .or. n2.NE.n6) then
  98. segdes,mlree1,mlree2,mlree6
  99. call ERREUR(217)
  100. GOTO 900
  101. endif
  102. segact,mlree3
  103. ma = mlree3.prog(/1)
  104. segdes,mlree3
  105. if (ma.LE.0) then
  106. segdes,mlree1,mlree2,mlree6
  107. call ERREUR(21)
  108. GOTO 900
  109. endif
  110. segini,mlre11=mlree3
  111. lect(3) = mlre11
  112. jg = ma
  113. segini mlre12
  114. lect(11) = mlre12
  115. jg = ma*ma
  116. segini mlree8
  117. lect(8) = mlree8
  118. jg = ma
  119. segini mlree9
  120. lect(9) = mlree9
  121. jg = 2
  122. segini mlreel
  123. prog(1) = -1.
  124. prog(2) = -1.
  125. lect(10) = mlreel
  126. c
  127. * dimensionner critere
  128. ip2 = mlree2
  129. call ecrobj('LISTREEL',ip2)
  130. call opobje(14)
  131. call maximu(1)
  132. call lirree(umordo,1,iretou)
  133. if (umordo.GT.XSPETI.and.umordo.lt.1.d0) then
  134. xmordo(lapro) = umordo * umordo
  135. else
  136. xmordo(lapro) = 1.D0
  137. endif
  138. c
  139. else
  140. c* else if (iprocc.gt.0) then
  141. do idon = 1, NTYP
  142. if (lect(idon).LE.0) then
  143. * write(ioimp,*) '!! IPROCC =',iprocc
  144. * iprocc = 0
  145. iprocm(lapro,1) = 0
  146. iprocm(lapro,2) = 0
  147. if (idon.eq.7) then
  148. moterr(1:8) ='PROCEDUR'
  149. call erreur(37)
  150. else
  151. call erreur(201)
  152. endif
  153. GOTO 900
  154. endif
  155. enddo
  156.  
  157. call levma1(mlenti)
  158. endif
  159.  
  160. mlreel = lect(10)
  161. chi2 = prog(1)
  162. alamda = prog(2)
  163. *
  164. * write(ioimp,*)'levm',xmordo(lapro),chi2,(abs(chi2)/xmordo(lapro))
  165. if(((abs(chi2)/xmordo(lapro)).lt.1.e-6.and.chi2.gt.0)
  166. &.or.iprocc.gt.100.or.alamda.gt.1.e11) goto 80
  167. *
  168. iprocc = iprocc + 1
  169. iprocm(lapro,2) = iprocc
  170. ip1 = lect(11)
  171. call nomobj('LISTREEL','WLEVPARO',ip1)
  172. call ecrobj('LISTREEL',ip1)
  173. call ECRCHA('PARO')
  174. ip1 = lect(9)
  175. call nomobj('LISTREEL','WLEVBETA',ip1)
  176. call ecrobj('LISTREEL',ip1)
  177. call ECRCHA('BETA')
  178. ip1 = lect(8)
  179. call nomobj('LISTREEL','WLEVALPH',ip1)
  180. call ecrobj('LISTREEL',ip1)
  181. call ECRCHA('ALPH')
  182. ip1 = lect(7)
  183. call ecrobj('PROCEDUR',ip1)
  184. call ECRCHA('PROC')
  185. ip1 = lect(10)
  186. call nomobj('LISTREEL','WLEVCHI2',ip1)
  187. call ecrobj('LISTREEL',ip1)
  188. call ECRCHA('CHI2')
  189. ip1 = lect(6)
  190. call ecrobj('LISTREEL',ip1)
  191. call ECRCHA('SIGM')
  192. ip1 = lect(3)
  193. call nomobj('LISTREEL','WLEVPARA',ip1)
  194. call ecrobj('LISTREEL',ip1)
  195. call ECRCHA('PARA')
  196. ip1 = lect(2)
  197. call ecrobj('LISTREEL',ip1)
  198. call ECRCHA('ORDO')
  199. ip1 = lect(1)
  200. call ecrobj('LISTREEL',ip1)
  201. call ECRCHA('ABSC')
  202. call ECRCHA('LEVM')
  203. ip1 = lect(3)
  204. call ecrobj('LISTREEL',ip1)
  205. ip1 = lect(1)
  206. call ecrobj('LISTREEL',ip1)
  207. ip1 = lect(7)
  208. call ecrobj('PROCEDUR',ip1)
  209. GOTO 900
  210.  
  211. 80 continue
  212. if (alamda.gt.1.e11) write(ioimp,*) 'je ne sais pas faire mieux'
  213. * oubli des objets intermediares
  214. ip1 = lect(8)
  215. CALL NOMOBJ('ANNULE ','WLEVALPH',ip1)
  216. ip1 = lect(9)
  217. CALL NOMOBJ('ANNULE ','WLEVBETA',ip1)
  218. ip1 = lect(11)
  219. CALL NOMOBJ('ANNULE ','WLEVPARO',ip1)
  220.  
  221. mlree1 = lect(1)
  222. mlree2 = lect(2)
  223. mlree3 = lect(6)
  224. segdes mlree1,mlree2,mlree3
  225. mlree1 = lect(3)
  226. segini,mlree2=mlree1
  227. ip1 = mlree1
  228. CALL NOMOBJ('ANNULE ','WLEVPARA',ip1)
  229. ipout = mlree2
  230. mlreel = lect(10)
  231. chi2 = prog(1)
  232. ip1 = mlreel
  233. CALL NOMOBJ('ANNULE ','WLEVPARA',ip1)
  234. call ECRREE(chi2)
  235. call ECROBJ('LISTREEL', ipout)
  236. iprocm(lapro,1) = 0
  237. iprocm(lapro,2) = 0
  238.  
  239. 900 CONTINUE
  240. segsup mlenti
  241.  
  242. RETURN
  243. END
  244.  
  245.  
  246.  
  247.  
  248.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales