PageRenderTime 70ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 1ms

/RecoHI/HiJetAlgos/plugins/bpmpd-2.11.f

https://github.com/dgonzal/cmssw
FORTRAN Legacy | 10561 lines | 7634 code | 37 blank | 2890 comment | 1177 complexity | 881adb4359ed0b0928a69c6c0060d33f MD5 | raw file
Possible License(s): GPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. C Version for CMSSW, modified to suppress gfortran warnings
  2. C -------------------------------------------------------------------
  3. c Primal-dual method with supernodal cholesky factorization
  4. c Version 2.11 (1996 December)
  5. c Written by Cs. Meszaros, MTA SzTAKI, Budapest, Hungary
  6. c Questions, remarks to the e-mail address:
  7. c meszaros@lutra.sztaki.hu
  8. c
  9. c All rights reserved ! Free for academic and research use only !
  10. c Commercial users are required to purchase a software license.
  11. c
  12. c Related publications:
  13. c
  14. c Meszaros, Cs.: Fast Cholesky Factorization for Interior Point Methods
  15. c of Linear Programming. Computers & Mathematics with Applications,
  16. c Vol. 31. No.4/5 (1996) pp. 49-51.
  17. c
  18. c Meszaros, Cs.: The "inexact" minimum local fill-in ordering algorithm.
  19. c Working Paper WP 95-7, Computer and Automation Institute, Hungarian
  20. c Academy of Sciences
  21. c
  22. c Maros I., Meszaros Cs.: The Role of the Augmented System in Interior
  23. c Point Methods. European Journal of Operations Researches
  24. c (submitted)
  25. c
  26. c ===========================================================================
  27. c
  28. c Callable interface
  29. c
  30. c Standard form: ax-s=b u>=x,s>=l
  31. c
  32. c remarks:
  33. c EQ rows 0 >= s >= 0
  34. c GT rows +inf >= s >= 0
  35. c LT rows 0 >= s >= -inf
  36. c FR rows +inf >= s >= -inf
  37. c
  38. c input: obj objective function (to be minimize) (n)
  39. c rhs right-hand side (m)
  40. c lbound lower bounds (m+n)
  41. c ubound upper bounds (m+n)
  42. c colpnt pointer to the columns (n+1)
  43. c rowidx row indices (nz)
  44. c nonzeros nonzero values (nz)
  45. c big practical +inf
  46. c
  47. c output: code termination code
  48. c xs primal values
  49. c dv dual values
  50. c dspr dual resuduals
  51. c
  52. c Input arrays will be destroyed !
  53. c
  54. c ===========================================================================
  55. c
  56. subroutine solver(
  57. x obj,rhs,lbound,ubound,diag,odiag,xs,dxs,dxsn,up,dspr,ddspr,
  58. x ddsprn,dsup,ddsup,ddsupn,dv,ddv,ddvn,prinf,upinf,duinf,scale,
  59. x nonzeros,
  60. x vartyp,slktyp,colpnt,ecolpnt,count,vcstat,pivots,invprm,
  61. x snhead,nodtyp,inta1,prehis,rowidx,rindex,
  62. x code,opt,iter,corect,fixn,dropn,fnzmax,fnzmin,addobj,
  63. x bigbou,big,ft)
  64. c
  65. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  66. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  67. c
  68. common/initv/ prmin,upmax,dumin,stamet,safmet,premet,regul
  69. real*8 prmin,upmax,dumin
  70. integer*4 stamet,safmet,premet,regul
  71. c
  72. integer*4 fixn,dropn,code,iter,corect,fnzmin,fnzmax,ft
  73. real*8 addobj,opt,big,
  74. x obj(n),rhs(m),lbound(mn),ubound(mn),scale(mn),diag(mn),odiag(mn),
  75. x xs(mn),dxs(mn),dxsn(mn),up(mn),dspr(mn),ddspr(mn),ddsprn(mn),
  76. x dsup(mn),ddsup(mn),ddsupn(mn),dv(m),ddv(m),ddvn(m),
  77. x nonzeros(cfree),prinf(m),upinf(mn),duinf(mn),bigbou
  78. integer*4 vartyp(n),slktyp(m),colpnt(n1),ecolpnt(mn),
  79. x count(mn),vcstat(mn),pivots(mn),invprm(mn),snhead(mn),
  80. x nodtyp(mn),inta1(mn),prehis(mn),rowidx(cfree),rindex(rfree)
  81. c
  82. common/numer/ tplus,tzer
  83. real*8 tplus,tzer
  84. common/ascal/ objnor,rhsnor,scdiff,scpass,scalmet
  85. real*8 objnor,rhsnor,scdiff
  86. integer*4 scpass,scalmet
  87. c ---------------------------------------------------------------------------
  88. integer*4 i,j,k,active,pnt1,pnt2,prelen,freen
  89. real*8 scobj,scrhs,sol,lbig
  90. character*99 buff
  91. C CMSSW: Temporary integer array needed to avoid reusing REAL*8 for
  92. C integer storage
  93. integer*4 pmbig(m),ppbig(m),dmbig(n),dpbig(n)
  94. integer*4 iwork1(mn+mn),iwork2(mn+mn),iwork3(mn+mn),iwork4(mn+mn),
  95. & iwork5(mn+mn)
  96. c ---------------------------------------------------------------------------
  97. c
  98. c inicializalas
  99. c
  100. if(cfree.le.(nz+1)*2)then
  101. write(buff,'(1x,a)')'Not enough memory, realmem < nz !'
  102. call mprnt(buff)
  103. code=-2
  104. goto 50
  105. endif
  106. if(rfree.le.nz)then
  107. write(buff,'(1x,a)')'Not enough memory, intmem < nz !'
  108. call mprnt(buff)
  109. code=-2
  110. goto 50
  111. endif
  112. iter=0
  113. corect=0
  114. prelen=0
  115. fnzmin=cfree
  116. fnzmax=-1
  117. scobj=1.0d+0
  118. scrhs=1.0d+0
  119. code=0
  120. lbig=0.9d+0*big
  121. if(bigbou.gt.lbig)then
  122. lbig=bigbou
  123. big=lbig/0.9d+0
  124. endif
  125. do i=1,mn
  126. scale(i)=1.0d+0
  127. enddo
  128. c
  129. c Remove fix variables and free rows
  130. c
  131. do i=1,n
  132. vartyp(i)=0
  133. if(abs(ubound(i)-lbound(i)).le.tplus*(abs(lbound(i)+1.0d0)))then
  134. vartyp(i)= 1
  135. vcstat(i)=-2-1
  136. pnt1=colpnt(i)
  137. pnt2=colpnt(i+1)-1
  138. do j=pnt1,pnt2
  139. rhs(rowidx(j))=rhs(rowidx(j))-ubound(i)*nonzeros(j)
  140. enddo
  141. addobj=addobj+obj(i)*lbound(i)
  142. else
  143. vcstat(i)=0
  144. endif
  145. enddo
  146. do i=1,m
  147. slktyp(i)=0
  148. j=i+n
  149. if((ubound(j).gt.lbig).and.(lbound(j).lt.-lbig))then
  150. vcstat(j)=-2-1
  151. else
  152. vcstat(j)=0
  153. endif
  154. enddo
  155. c
  156. c p r e s o l v e r
  157. c
  158. call timer(k)
  159. if(premet.gt.0)then
  160. write(buff,'(1x)')
  161. call mprnt(buff)
  162. write(buff,'(1x,a)')'Process: presolv'
  163. call mprnt(buff)
  164. call presol(colpnt,rowidx,nonzeros,rindex,nonzeros(nz+1),
  165. x snhead,snhead(n1),nodtyp,nodtyp(n1),vcstat,vcstat(n1),
  166. x ecolpnt,count,ecolpnt(n1),count(n1),
  167. C CMSSW: Prevent REAL*8 reusage warning
  168. C Was: vartyp,dxsn(n1),dxs(n1),diag(n1),odiag(n1),
  169. x vartyp,dxsn(n1),dxs(n1),pmbig,ppbig,
  170. x ubound,lbound,ubound(n1),lbound(n1),rhs,obj,prehis,prelen,
  171. C CMSSW: Prevent REAL*8 reusage warning
  172. C Was: addobj,big,pivots,invprm,dv,ddv,dxsn,dxs,diag,odiag,premet,code)
  173. x addobj,big,pivots,invprm,dv,ddv,dxsn,dxs,dmbig,dpbig,premet,
  174. x code)
  175. write(buff,'(1x,a)')'Presolv done...'
  176. call mprnt(buff)
  177. if(code.ne.0)goto 45
  178. endif
  179. c
  180. c Remove lower bounds
  181. c
  182. call stndrd(ubound,lbound,rhs,obj,nonzeros,
  183. x vartyp,slktyp,vcstat,colpnt,rowidx,addobj,tplus,tzer,lbig,big)
  184. c
  185. c Scaling before aggregator
  186. c
  187. i=iand(scalmet,255)
  188. j=iand(scpass,255)
  189. if(i.gt.0)call mscale(colpnt,rowidx,nonzeros,obj,rhs,ubound,
  190. x vcstat,scale,upinf,i,j,scdiff,ddsup,dxsn,dxs,snhead)
  191. c
  192. c Aggregator
  193. c
  194. if(premet.gt.127)then
  195. write(buff,'(1x)')
  196. call mprnt(buff)
  197. write(buff,'(1x,a)')'Process: aggregator'
  198. call mprnt(buff)
  199. call aggreg(colpnt,rowidx,nonzeros,rindex,
  200. x vcstat,vcstat(n1),ecolpnt,count,ecolpnt(n1),count(n1),
  201. x rhs,obj,prehis,prelen,pivots,vartyp,slktyp,invprm,snhead,
  202. x nodtyp,inta1,inta1(n1),dv,addobj,premet,code)
  203. write(buff,'(1x,a)')'Aggregator done...'
  204. call mprnt(buff)
  205. if(code.ne.0)goto 55
  206. endif
  207. c
  208. c Scaling after aggregator
  209. c
  210. i=scalmet/256
  211. j=scpass/256
  212. if(i.gt.0)call mscale(colpnt,rowidx,nonzeros,obj,rhs,
  213. x ubound,vcstat,scale,upinf,i,j,scdiff,ddsup,dxsn,dxs,snhead)
  214. c
  215. call timer(j)
  216. write(buff,'(1x)')
  217. call mprnt(buff)
  218. write(buff,'(1x,a,f8.2,a)')
  219. x 'Time for presolv, scaling and aggregator: ',0.01*(j-k),' sec.'
  220. call mprnt(buff)
  221. c
  222. c cleaning
  223. c
  224. do i=1,mn
  225. xs(i)=0.0d+0
  226. dspr(i)=0.0d+0
  227. dsup(i)=0.0d+0
  228. up(i)=0.0d+0
  229. enddo
  230. do i=1,m
  231. dv(i)=0.0d+0
  232. enddo
  233. c
  234. c Is the problem solved ?
  235. c
  236. fixn=0
  237. dropn=0
  238. freen=0
  239. do i=1,n
  240. if(vcstat(i).le.-2)then
  241. fixn=fixn+1
  242. else if(vartyp(i).eq.0) then
  243. freen=freen+1
  244. endif
  245. enddo
  246. do i=1,m
  247. if(vcstat(i+n).le.-2)dropn=dropn+1
  248. enddo
  249. active=mn-fixn-dropn
  250. if(active.eq.0)code=2
  251. if(code.gt.0)then
  252. opt=addobj
  253. write(buff,'(1x,a)')'Problem is solved by the pre-solver'
  254. call mprnt(buff)
  255. if(code.gt.0)goto 55
  256. goto 50
  257. endif
  258. c
  259. c Presolve statistics
  260. c
  261. if(premet.gt.0)then
  262. i=0
  263. j=0
  264. do k=1,n
  265. if(vcstat(k).gt.-2)then
  266. i=i+count(k)-ecolpnt(k)+1
  267. if(j.lt.count(k)-ecolpnt(k)+1)j=count(k)-ecolpnt(k)+1
  268. endif
  269. enddo
  270. write(buff,'(1x,a22,i8)')'Number of rows :',(m-dropn)
  271. call mprnt(buff)
  272. write(buff,'(1x,a22,i8)')'Number of columns :',(n-fixn)
  273. call mprnt(buff)
  274. write(buff,'(1x,a22,i8)')'Free variables :',freen
  275. call mprnt(buff)
  276. write(buff,'(1x,a22,i8)')'No. of nonzeros :',i
  277. call mprnt(buff)
  278. write(buff,'(1x,a22,i8)')'Longest column count :',j
  279. call mprnt(buff)
  280. endif
  281. c
  282. c Incrase rowidx by n
  283. c
  284. j=colpnt(1)
  285. k=colpnt(n+1)-1
  286. do i=j,k
  287. rowidx(i)=rowidx(i)+n
  288. enddo
  289. active=mn-fixn-dropn
  290. c
  291. c Normalize obj and rhs
  292. c
  293. if(objnor.gt.tzer)then
  294. call scalobj(obj,scobj,vcstat,objnor)
  295. endif
  296. if(rhsnor.gt.tzer)then
  297. call scalrhs(rhs,scrhs,vcstat,rhsnor,ubound,xs,up)
  298. endif
  299. c
  300. c Calling phas12
  301. c
  302. sol=scobj*scrhs
  303. i=mn+mn
  304. call timer(k)
  305. call phas12(
  306. x obj,rhs,ubound,diag,odiag,xs,dxs,dxsn,up,dspr,ddspr,
  307. x ddsprn,dsup,ddsup,ddsupn,dv,ddv,ddvn,nonzeros,prinf,upinf,duinf,
  308. x vartyp,slktyp,colpnt,ecolpnt,count,vcstat,pivots,invprm,
  309. x snhead,nodtyp,inta1,rowidx,rindex,
  310. C CMSSW: Prevent REAL*8 reusage warning
  311. C Was: dxs,dxsn,ddspr,ddsprn,ddsup,ddsupn,
  312. x dxs,iwork1,iwork2,iwork3,iwork4,iwork5,
  313. x code,opt,iter,corect,fixn,dropn,active,fnzmax,fnzmin,addobj,
  314. x sol,ft,i)
  315. call timer(j)
  316. write(buff,'(1x,a,f11.2,a)')'Solver time ',0.01*(j-k),' sec.'
  317. call mprnt(buff)
  318. c
  319. c Decrease rowidx by n
  320. c
  321. j=colpnt(1)
  322. k=colpnt(n+1)-1
  323. do i=j,k
  324. rowidx(i)=rowidx(i)-n
  325. enddo
  326. c
  327. c Rescaling
  328. c
  329. 55 do i=1,m
  330. rhs(i)=rhs(i)*scrhs*scale(i+n)
  331. ubound(i+n)=ubound(i+n)*scrhs*scale(i+n)
  332. xs(i+n)=xs(i+n)*scrhs*scale(i+n)
  333. up(i+n)=up(i+n)*scrhs*scale(i+n)
  334. dv(i)=dv(i)*scobj/scale(i+n)
  335. dspr(i+n)=dspr(i+n)/scale(i+n)*scobj
  336. dsup(i+n)=dsup(i+n)/scale(i+n)*scobj
  337. enddo
  338. c
  339. do i=1,n
  340. obj(i)=obj(i)*scobj*scale(i)
  341. ubound(i)=ubound(i)*scrhs/scale(i)
  342. pnt1=colpnt(i)
  343. pnt2=colpnt(i+1)-1
  344. do j=pnt1,pnt2
  345. nonzeros(j)=nonzeros(j)*scale(i)*scale(rowidx(j)+n)
  346. enddo
  347. c
  348. xs(i)=xs(i)/scale(i)*scrhs
  349. up(i)=up(i)/scale(i)*scrhs
  350. dspr(i)=dspr(i)*scale(i)*scobj
  351. dsup(i)=dsup(i)*scale(i)*scobj
  352. enddo
  353. c
  354. c Postprocessing
  355. c
  356. 45 call pstsol(colpnt,rowidx,nonzeros,vcstat,vcstat(n1),
  357. x vartyp,slktyp,ubound,lbound,ubound(n1),lbound(n1),rhs,obj,xs,
  358. x inta1,ddvn,prehis,prelen,big)
  359. c
  360. 50 return
  361. end
  362. c
  363. c ===========================================================================
  364. c
  365. subroutine stndrd(ubound,lbound,rhs,obj,nonzeros,
  366. x vartyp,slktyp,vcstat,colpnt,rowidx,addobj,tplus,tzer,lbig,big)
  367. c
  368. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  369. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  370. c
  371. integer*4 vartyp(n),slktyp(m),vcstat(mn),colpnt(n1),rowidx(nz)
  372. real*8 ubound(mn),lbound(mn),rhs(m),obj(n),nonzeros(nz),
  373. x addobj,tplus,tzer,lbig,big
  374. c
  375. integer*4 i,j,k,pnt1,pnt2
  376. c
  377. c generate standard form, row modification
  378. c
  379. k=0
  380. do 150 i=1,m
  381. j=i+n
  382. if(vcstat(j).gt.-2)then
  383. if(abs(ubound(j)-lbound(j)).le.tplus*(abs(lbound(j))+1d0))then
  384. slktyp(i)=0
  385. ubound(j)=0.0d+00
  386. rhs(i)=rhs(i)+lbound(j)
  387. goto 150
  388. endif
  389. ccc if((ubound(j).gt.lbig).and.(lbound(j).lt.-lbig))then
  390. ccc vcstat(j)=-2
  391. ccc slktyp(i)=0
  392. ccc goto 150
  393. ccc endif
  394. if(lbound(j).lt.-lbig)then
  395. slktyp(i)=2
  396. lbound(j)=-ubound(j)
  397. ubound(j)=big
  398. rhs(i)=-rhs(i)
  399. k=k+1
  400. else
  401. slktyp(i)=1
  402. endif
  403. rhs(i)=rhs(i)+lbound(j)
  404. ubound(j)=ubound(j)-lbound(j)
  405. if(ubound(j).lt.lbig)slktyp(i)=-slktyp(i)
  406. else
  407. slktyp(i)=0
  408. endif
  409. 150 continue
  410. c
  411. c negate reverse rows
  412. c
  413. if(k.gt.0)then
  414. do i=1,n
  415. pnt1=colpnt(i)
  416. pnt2=colpnt(i+1)-1
  417. do j=pnt1,pnt2
  418. if(abs(slktyp(rowidx(j))).ge.2)nonzeros(j)=-nonzeros(j)
  419. enddo
  420. enddo
  421. endif
  422. c
  423. c column modification
  424. c
  425. do 155 i=1,n
  426. if(vcstat(i).gt.-2)then
  427. ccc if(abs(ubound(i)-lbound(i)).le.tplus*(abs(lbound(i))+1d0))then
  428. ccc vcstat(i)=-2
  429. ccc vartyp(i)= 1
  430. ccc do j=colpnt(i),colpnt(i+1)-1
  431. ccc rhs(rowidx(j))=rhs(rowidx(j))-nonzeros(j)*lbound(i)
  432. ccc enddo
  433. ccc addobj=addobj+obj(i)*lbound(i)
  434. ccc goto 155
  435. ccc endif
  436. if((ubound(i).gt.lbig).and.(lbound(i).lt.-lbig))then
  437. vartyp(i)=0
  438. goto 155
  439. endif
  440. if(lbound(i).lt.-lbig)then
  441. vartyp(i)=2
  442. lbound(i)=-ubound(i)
  443. ubound(i)=big
  444. obj(i)=-obj(i)
  445. do j=colpnt(i),colpnt(i+1)-1
  446. nonzeros(j)=-nonzeros(j)
  447. enddo
  448. else
  449. vartyp(i)=1
  450. endif
  451. if(abs(lbound(i)).gt.tzer)then
  452. if(ubound(i).lt.lbig)ubound(i)=ubound(i)-lbound(i)
  453. do j=colpnt(i),colpnt(i+1)-1
  454. rhs(rowidx(j))=rhs(rowidx(j))-nonzeros(j)*lbound(i)
  455. enddo
  456. addobj=addobj+obj(i)*lbound(i)
  457. endif
  458. if(ubound(i).lt.lbig)vartyp(i)=-vartyp(i)
  459. endif
  460. 155 continue
  461. return
  462. end
  463. c
  464. c ===========================================================================
  465. c Primal-dual method with supernodal cholesky factorization
  466. c Version 2.11 (1996 December)
  467. c Written by Cs. Meszaros, MTA SzTAKI, Budapest, Hungary
  468. c e-mail: meszaros@lutra.sztaki.hu
  469. c see "bpmain.f"
  470. c
  471. c code=-2 General memory limit (no solution)
  472. c code=-1 Memory limit during iterations
  473. c code= 0
  474. c code= 1 No optimum
  475. c code= 2 Otimal solution
  476. c code= 3 Primal Infeasible
  477. c code= 4 Dual Infeasible
  478. c
  479. c ===========================================================================
  480. c
  481. subroutine phas12(
  482. x obj,rhs,bounds,diag,odiag,xs,dxs,dxsn,up,dspr,ddspr,
  483. x ddsprn,dsup,ddsup,ddsupn,dv,ddv,ddvn,nonzeros,prinf,upinf,duinf,
  484. x vartyp,slktyp,colpnt,ecolpnt,count,vcstat,pivots,invprm,
  485. x snhead,nodtyp,inta1,rowidx,rindex,
  486. x rwork1,iwork1,iwork2,iwork3,iwork4,iwork5,
  487. x code,opt,iter,corect,fixn,dropn,active,fnzmax,fnzmin,addobj,
  488. x scobj,factim,mn2)
  489. c
  490. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  491. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  492. c
  493. common/mscal/ varadd,slkadd,scfree
  494. real*8 varadd,slkadd,scfree
  495. c
  496. common/numer/ tplus,tzer
  497. real*8 tplus,tzer
  498. c
  499. common/param/ palpha,dalpha
  500. real*8 palpha,dalpha
  501. c
  502. common/factor/ tpiv1,tpiv2,tabs,trabs,lam,tfind,order,supdens
  503. real*8 tpiv1,tpiv2,tabs,trabs,lam,tfind,order,supdens
  504. c
  505. common/toler/ tsdir,topt1,topt2,tfeas1,tfeas2,feas1,feas2,
  506. x pinfs,dinfs,inftol,maxiter
  507. real*8 tsdir,topt1,topt2,tfeas1,tfeas2,feas1,feas2,
  508. x pinfs,dinfs,inftol
  509. integer*4 maxiter
  510. c
  511. common/initv/ prmin,upmax,dumin,stamet,safmet,premet,regul
  512. real*8 prmin,upmax,dumin
  513. integer*4 stamet,safmet,premet,regul
  514. c
  515. integer*4 fixn,dropn,active,code,iter,corect,fnzmin,fnzmax,mn2
  516. real*8 addobj,scobj,opt
  517. c
  518. common/predp/ ccstop,barset,bargrw,barmin,mincor,maxcor,inibar
  519. real*8 ccstop,barset,bargrw,barmin
  520. integer*4 mincor,maxcor,inibar
  521. c
  522. common/predc/ target,tsmall,tlarge,center,corstp,mincc,maxcc
  523. real*8 target,tsmall,tlarge,center,corstp
  524. integer*4 mincc,maxcc
  525. common/itref/ tresx,tresy,maxref
  526. real*8 tresx,tresy
  527. integer*4 maxref
  528. c
  529. real*8 obj(n),rhs(m),bounds(mn),diag(mn),odiag(mn),xs(mn),
  530. x dxs(mn),dxsn(mn),up(mn),dspr(mn),ddspr(mn),ddsprn(mn),dsup(mn),
  531. x ddsup(mn),ddsupn(mn),dv(m),ddv(m),ddvn(m),nonzeros(cfree),
  532. x prinf(m),upinf(mn),duinf(mn),rwork1(mn)
  533. integer*4 vartyp(n),slktyp(m),colpnt(n1),ecolpnt(mn),count(mn),
  534. x vcstat(mn),pivots(mn),invprm(mn),snhead(mn),nodtyp(mn),
  535. x inta1(mn),rowidx(cfree),rindex(rfree),factim,
  536. x iwork1(mn2),iwork2(mn2),iwork3(mn2),iwork4(mn2),iwork5(mn2)
  537. c
  538. c ---------------------------------------------------------------------------
  539. c
  540. integer*4 i,j,err,factyp,pphase,dphase,t1,t2,opphas,odphas
  541. real*8 pinf,dinf,uinf,prelinf,drelinf,popt,dopt,cgap,
  542. x prstpl,dustpl,barpar,oper,maxstp,pinfrd,dinfrd,objerr,nonopt,
  543. x oprelinf,odrelinf,opinf,odinf,ocgap
  544. integer*4 corr,corrc,barn,fxp,fxd,fxu,nropt
  545. character*99 buff,sbuff
  546. character*1 wmark
  547. c
  548. c to save parameters
  549. c
  550. integer*4 maxcco,mxrefo
  551. real*8 lamo,spdeno,bargro,topto
  552. C CMSSW: Temporary integer array needed to avoid reusing REAL*8 for
  553. C integer storage
  554. integer*4 inta12(mn)
  555. c
  556. c --------------------------------------------------------------------------
  557. c
  558. 101 format(1x,' ')
  559. 102 format(1x,'It-PC P.Inf D.Inf U.Inf Actions ',
  560. x 'P.Obj D.Obj Barpar')
  561. 103 format(1x,'------------------------------------------------',
  562. x '------------------------------')
  563. 104 format(1x,I2,a1,I1,I1,' ',1PD7.1,' ',1PD7.1,' ',1PD6.0,
  564. x ' ',I2,' ',I3,' ',I3,' ',1PD15.8,' ',1PD15.8,' ',1PD6.0)
  565. c
  566. c Saving parameters
  567. c
  568. maxcco=maxcc
  569. mxrefo=maxref
  570. lamo=lam
  571. spdeno=supdens
  572. bargro=bargrw
  573. topto=topt1
  574. c
  575. c Include dummy ranges if requested
  576. c
  577. if(regul.gt.0)then
  578. do i=1,m
  579. if(slktyp(i).eq.0)then
  580. slktyp(i)=-1
  581. bounds(i+n)=0.0d+0
  582. endif
  583. enddo
  584. endif
  585. c
  586. c Other initialization
  587. c
  588. nropt=0
  589. factim=0
  590. wmark='-'
  591. fxp=0
  592. fxd=0
  593. fxu=0
  594. c
  595. call stlamb(colpnt,vcstat,rowidx,inta1,fixn,dropn,factyp)
  596. call timer(t1)
  597. j=0
  598. do i=1,n
  599. if((vcstat(i).gt.-2).and.(vartyp(i).eq.0))j=j+1
  600. enddo
  601. if((j.gt.0).and.(scfree.lt.tzer))factyp=1
  602. c
  603. c Initial scaling matrix (diagonal)
  604. c
  605. call fscale (vcstat,diag,odiag,vartyp,slktyp)
  606. do i=1,m
  607. dv(i)=0.0d+0
  608. enddo
  609. ccc i=2*rfree
  610. ccc j=400
  611. ccc call paintmat(m,n,nz,i,rowidx,colpnt,rindex,j,'matrix01.pic')
  612. c
  613. c Initial factorization
  614. c
  615. fnzmax=0
  616. if(factyp.eq.1)then
  617. call ffactor(ecolpnt,vcstat,colpnt,rowidx,
  618. x iwork4,pivots,count,nonzeros,diag,
  619. x iwork1,iwork1(mn+1),iwork2,iwork2(mn+1),inta1,iwork5,
  620. x iwork5(mn+1),iwork3,iwork3(mn+1),iwork4(mn+1),rindex,
  621. x rwork1,fixn,dropn,fnzmax,fnzmin,active,oper,xs,slktyp,code)
  622. if(code.ne.0)goto 999
  623. call supnode(ecolpnt,count,rowidx,vcstat,pivots,snhead,
  624. x invprm,nodtyp)
  625. else
  626. c
  627. c minimum local fill-in ordering
  628. c
  629. i=int(tfind)
  630. if(order.lt.1.5)i=0
  631. if(order.lt.0.5)i=-1
  632. call symmfo(inta1,pivots,ecolpnt,vcstat,
  633. x colpnt,rowidx,nodtyp,rindex,iwork3,invprm,
  634. x count,snhead,iwork1,iwork1(mn+1),iwork2,iwork2(mn+1),
  635. x iwork4,iwork4(mn+1),iwork3(mn+1),iwork5,iwork5(mn+1),
  636. C CMSSW: Prevent REAL*8 reusage warning
  637. C Was: nonzeros,fnzmax,oper,i,rwork1,code
  638. x nonzeros,fnzmax,oper,i,inta12,code)
  639. if(code.ne.0)goto 999
  640. call supnode(ecolpnt,count,rowidx,vcstat,pivots,snhead,
  641. x invprm,nodtyp)
  642. popt=trabs
  643. trabs=tabs
  644. call nfactor(ecolpnt,vcstat,rowidx,pivots,count,nonzeros,
  645. x diag,err,rwork1,iwork2,iwork2(mn+1),dropn,slktyp,
  646. x snhead,iwork3,invprm,nodtyp,dv,odiag)
  647. trabs=popt
  648. endif
  649. fnzmin=fnzmax
  650. c
  651. c Compute centrality and iterative refinement power
  652. c
  653. if(fnzmin.eq.0)fnzmin=1
  654. cgap=oper/fnzmin/10.0d+0
  655. j=0
  656. 78 if(cgap.ge.1.0d+0)then
  657. cgap=cgap/2
  658. j=j+1
  659. goto 78
  660. endif
  661. if(j.eq.0)j=1
  662. if(maxcc.le.0d+0)then
  663. maxcc=-maxcc
  664. else
  665. if(j.le.maxcc)maxcc=j
  666. endif
  667. if(mincc.gt.maxcc)maxcc=mincc
  668. cgap=log(1.0d+0+oper/fnzmin/5.0d+0)/log(2.0d+00)
  669. if(maxref.le.0)then
  670. maxref=-maxref
  671. else
  672. maxref=int(cgap*maxref)
  673. endif
  674. if(maxref.le.0)maxref=0
  675. write(buff,'(1x,a,i2)')'Centrality correction Power:',maxcc
  676. call mprnt(buff)
  677. write(buff,'(1x,a,i2)')'Iterative refinement Power:',maxref
  678. call mprnt(buff)
  679. c
  680. c Starting point
  681. c
  682. call initsol(xs,up,dv,dspr,dsup,rhs,obj,bounds,vartyp,slktyp,
  683. x vcstat,colpnt,ecolpnt,pivots,rowidx,nonzeros,diag,rwork1,
  684. x count)
  685. call timer(t2)
  686. c
  687. write(buff,'(1x,a,f12.2,a)')'FIRSTFACTOR TIME :',
  688. x (dble(t2-t1)*0.01d+0),' sec'
  689. call mprnt(buff)
  690. c
  691. maxstp=1.0d+0
  692. iter=0
  693. corect=0
  694. corr=0
  695. corrc=0
  696. barn=0
  697. cgap=0.0d+0
  698. do i=1,mn
  699. if(vcstat(i).gt.-2)then
  700. if(i.le.n)then
  701. j=vartyp(i)
  702. else
  703. j=slktyp(i-n)
  704. endif
  705. if(j.ne.0)then
  706. cgap=cgap+xs(i)*dspr(i)
  707. barn=barn+1
  708. endif
  709. if(j.lt.0)then
  710. cgap=cgap+up(i)*dsup(i)
  711. barn=barn+1
  712. endif
  713. endif
  714. enddo
  715. if(barn.lt.1)barn=1
  716. ccc i=2*rfree
  717. ccc j=350
  718. ccc call paintaat(mn,nz,pivotn,i,rowidx,ecolpnt,count,rindex,
  719. ccc x j,pivots,iwork1,iwork1(mn+1),iwork2,iwork2(mn+1),iwork3,
  720. ccc x iwork3(mn+1),'normal01.pic')
  721. ccc i=2*rfree
  722. ccc j=400
  723. ccc call paintata(mn,nz,pivotn,i,rowidx,ecolpnt,count,rindex,
  724. ccc x j,pivots,iwork1,iwork1(mn+1),iwork2,iwork2(mn+1),iwork3,
  725. ccc x 'atapat01.pic')
  726. ccc i=2*rfree
  727. ccc j=350
  728. ccc err=nz
  729. ccc call paintfct(mn,cfree,pivotn,i,rowidx,ecolpnt,count,rindex,
  730. ccc x j,pivots,iwork2,err,'factor01.pic')
  731. c
  732. c Initialize for the iteration loop
  733. c
  734. do i=1,n
  735. if((vcstat(i).gt.-2).and.(vartyp(i).ne.0))then
  736. if(xs(i).gt.dspr(i))then
  737. vcstat(i)=1
  738. else
  739. vcstat(i)=0
  740. endif
  741. endif
  742. enddo
  743. do i=1,m
  744. if((vcstat(i+n).gt.-2).and.(slktyp(i).ne.0))then
  745. if(xs(i+n).gt.dspr(i+n))then
  746. vcstat(i+n)=1
  747. else
  748. vcstat(i+n)=0
  749. endif
  750. endif
  751. enddo
  752. opphas=0
  753. odphas=0
  754. pinfrd=1.0d+0
  755. dinfrd=1.0d+0
  756. barpar=0.0d+0
  757. c
  758. c main iteration loop
  759. c
  760. 10 if(mod(iter,20).eq.0)then
  761. write(buff,101)
  762. call mprnt(buff)
  763. write(buff,102)
  764. call mprnt(buff)
  765. write(buff,103)
  766. call mprnt(buff)
  767. endif
  768. c
  769. c Infeasibilities
  770. c
  771. call cprinf(xs,prinf,slktyp,colpnt,rowidx,nonzeros,
  772. x rhs,vcstat,pinf)
  773. call cduinf(dv,dspr,dsup,duinf,vartyp,slktyp,colpnt,rowidx,
  774. x nonzeros,obj,vcstat,dinf)
  775. call cupinf(xs,up,upinf,bounds,vartyp,slktyp,vcstat,
  776. x uinf)
  777. c
  778. c Objectives
  779. c
  780. call cpdobj(popt,dopt,obj,rhs,bounds,xs,dv,dsup,
  781. x vcstat,vartyp,slktyp)
  782. popt=scobj*popt+addobj
  783. dopt=scobj*dopt+addobj
  784. c
  785. c Stopping criteria
  786. c
  787. call stpcrt(prelinf,drelinf,popt,dopt,cgap,iter,
  788. x code,pphase,dphase,maxstp,pinf,uinf,dinf,
  789. x prinf,upinf,duinf,nonopt,pinfrd,dinfrd,
  790. x prstpl,dustpl,obj,rhs,bounds,xs,dxs,dspr,ddspr,dsup,ddsup,dv,ddv,
  791. x up,addobj,scobj,vcstat,vartyp,slktyp,
  792. x oprelinf,odrelinf,opinf,odinf,ocgap,opphas,odphas,sbuff)
  793. c
  794. write(buff,104)iter,wmark,corr,corrc,pinf,dinf,uinf,fxp,fxd,fxu,
  795. x popt,dopt,barpar
  796. call mprnt(buff)
  797. if(code.ne.0)then
  798. write(buff,'(1x)')
  799. call mprnt(buff)
  800. call mprnt(sbuff)
  801. goto 90
  802. endif
  803. c
  804. c P-D solution modification
  805. c
  806. call pdmodi(xs,dspr,vcstat,vartyp,slktyp,cgap,popt,
  807. x dopt,prinf,duinf,upinf,colpnt,rowidx,nonzeros,pinf,uinf,dinf)
  808. c
  809. c Fixing variables / dropping rows / handling dual slacks
  810. c
  811. i=fixn
  812. call varfix(vartyp,slktyp,rhs,colpnt,rowidx,nonzeros,
  813. x xs,up,dspr,dsup,vcstat,fixn,dropn,addobj,scobj,obj,bounds,
  814. x duinf,dinf,fxp,fxd,fxu)
  815. if(fixn.ne.i)then
  816. call supupd(pivots,invprm,snhead,nodtyp,vcstat,ecolpnt)
  817. call cprinf(xs,prinf,slktyp,colpnt,rowidx,nonzeros,
  818. x rhs,vcstat,pinf)
  819. call cupinf(xs,up,upinf,bounds,vartyp,slktyp,vcstat,
  820. x uinf)
  821. endif
  822. c
  823. c Compute gap
  824. c
  825. cgap=0.0d+0
  826. do i=1,mn
  827. if(vcstat(i).gt.-2)then
  828. if(i.le.n)then
  829. j=vartyp(i)
  830. else
  831. j=slktyp(i-n)
  832. endif
  833. if(j.ne.0)then
  834. cgap=cgap+xs(i)*dspr(i)
  835. if(j.lt.0)then
  836. cgap=cgap+up(i)*dsup(i)
  837. endif
  838. endif
  839. endif
  840. enddo
  841. c
  842. c Computation of the scaling matrix
  843. c
  844. objerr=abs(dopt-popt)/(abs(popt)+1.0d+0)
  845. call cdiag(xs,up,dspr,dsup,vartyp,slktyp,vcstat,diag,odiag)
  846. pinfrd=pinf
  847. dinfrd=dinf
  848. c
  849. c The actual factorization
  850. c
  851. 50 err=0
  852. call timer(t1)
  853. if (factyp.eq.1) then
  854. call mfactor(ecolpnt,vcstat,colpnt,rowidx,pivots,
  855. x count,iwork4,nonzeros,diag,err,rwork1,iwork2,iwork2(mn+1),
  856. x dropn,slktyp,snhead,iwork3,invprm,nodtyp,dv,odiag)
  857. else
  858. call nfactor(ecolpnt,vcstat,rowidx,pivots,count,nonzeros,
  859. x diag,err,rwork1,iwork2,iwork2(mn+1),dropn,slktyp,
  860. x snhead,iwork3,invprm,nodtyp,dv,odiag)
  861. endif
  862. call timer(t2)
  863. if(err.gt.0)then
  864. do i=1,mn
  865. diag(i)=odiag(i)
  866. enddo
  867. call newsmf(colpnt,pivots,rowidx,nonzeros,ecolpnt,count,
  868. x vcstat,invprm,snhead,nodtyp,iwork1,rwork1,iwork2,iwork3,
  869. x iwork4,code)
  870. if(code.lt.0)then
  871. write(buff,'(1x)')
  872. call mprnt(buff)
  873. goto 90
  874. endif
  875. goto 50
  876. endif
  877. factim=factim+t2-t1
  878. c
  879. c We are in the finish ?
  880. c
  881. wmark(1:1)='-'
  882. if(objerr.gt.1.0d+0)objerr=1.0d+0
  883. if(objerr.lt.topt1)objerr=topt1
  884. if((objerr.le.topt1*10.0d+0).and.(pphase+dphase.eq.4))then
  885. if(bargrw.gt.0.1d+0)bargrw=0.1d+0
  886. nropt=nropt+1
  887. if(nropt.eq.5)then
  888. nropt=0
  889. topt1=topt1*sqrt(10.d+0)
  890. write(buff,'(1x,a)')'Near otptimal but slow convergence.'
  891. call mprnt(buff)
  892. endif
  893. wmark(1:1)='+'
  894. endif
  895. c
  896. c primal-dual predictor-corrector direction
  897. c
  898. call cpdpcd(xs,up,dspr,dsup,prinf,duinf,upinf,
  899. x dxsn,ddvn,ddsprn,ddsupn,dxs,ddv,ddspr,ddsup,bounds,
  900. x ecolpnt,count,pivots,vcstat,diag,odiag,rowidx,nonzeros,
  901. x colpnt,vartyp,slktyp,barpar,corr,prstpl,dustpl,barn,cgap)
  902. corect=corect+corr
  903. c
  904. c primal-dual centality-correction
  905. c
  906. call cpdccd(xs,up,dspr,dsup,upinf,
  907. x dxsn,ddvn,ddsprn,ddsupn,dxs,ddv,ddspr,ddsup,bounds,
  908. x ecolpnt,count,pivots,vcstat,diag,odiag,rowidx,nonzeros,
  909. x colpnt,vartyp,slktyp,barpar,corrc,prstpl,dustpl)
  910. corect=corect+corrc
  911. c
  912. c compute steplengths
  913. c
  914. iter=iter+1
  915. prstpl=prstpl*palpha
  916. dustpl=dustpl*dalpha
  917. c
  918. c compute the new primal-dual solution
  919. c
  920. call cnewpd(prstpl,xs,dxs,up,upinf,dustpl,dv,ddv,dspr,
  921. x ddspr,dsup,ddsup,vartyp,slktyp,vcstat,maxstp)
  922. c
  923. c End main loop
  924. c
  925. goto 10
  926. c
  927. 90 opt=(dopt-popt)/(abs(popt)+1.0d+0)
  928. write(buff,'(1x,a,1PD11.4,a,1PD18.10)')
  929. x 'ABSOLUTE infeas. Primal :',pinf, ' Dual :',dinf
  930. call mprnt(buff)
  931. write(buff,'(1x,a,1PD11.4,a,1PD18.10)')
  932. x 'PRIMAL : Relative infeas. :',prelinf,' Objective :',popt
  933. call mprnt(buff)
  934. write(buff,'(1x,a,1PD11.4,a,1PD18.10)')
  935. x 'DUAL : Relative infeas. :',drelinf,' Objective :',dopt
  936. call mprnt(buff)
  937. write(buff,'(1x,a,1PD11.4,a,1PD18.10)')
  938. x 'Complementarity gap :',cgap,' Duality gap :',opt
  939. call mprnt(buff)
  940. opt=popt
  941. c
  942. c Restoring parameters
  943. c
  944. 999 maxcc=maxcco
  945. maxref=mxrefo
  946. lam=lamo
  947. supdens=spdeno
  948. bargrw=bargro
  949. topt1=topto
  950. return
  951. end
  952. c
  953. c ===========================================================================
  954. c ===========================================================================
  955. c
  956. subroutine mscale(colpnt,rowidx,nonzeros,
  957. x obj,rhs,ubound,vcstat,scale,scalen,scalmet,scpass,scdiff,
  958. x ddsup,ddsupn,dxs,snhead)
  959. c
  960. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  961. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  962. c
  963. integer*4 colpnt(n1),rowidx(nz),vcstat(mn),
  964. x scalmet,scpass,snhead(mn)
  965. real*8 nonzeros(cfree),obj(n),rhs(m),ubound(mn),scale(mn),
  966. x scalen(mn),scdiff,ddsup(mn),ddsupn(mn),dxs(mn)
  967. c
  968. integer*4 i
  969. character*99 buff
  970. c
  971. write(buff,'(1x)')
  972. call mprnt(buff)
  973. write(buff,'(1x,a)')'Process: scaling'
  974. call mprnt(buff)
  975. c
  976. do i=1,mn
  977. scalen(i)=1.0d+0
  978. enddo
  979. c
  980. if((scalmet.eq.2).or.(scalmet.eq.4))then
  981. call scale1(ubound,nonzeros,colpnt,obj,scalen,vcstat,
  982. x rowidx,rhs,ddsup,scpass,scdiff,snhead,nonzeros(nz+1))
  983. endif
  984. if((scalmet.eq.3).or.(scalmet.eq.5))then
  985. call scale2(ubound,nonzeros,colpnt,obj,scalen,vcstat,
  986. x rowidx,rhs,scpass,scdiff,ddsup,ddsupn,dxs,snhead)
  987. endif
  988. if((scalmet.gt.0).and.(scalmet.le.3))then
  989. call sccol2(ubound,nonzeros,colpnt,obj,scalen,
  990. x vcstat,rowidx)
  991. call scrow2(rhs,ubound,nonzeros,rowidx,colpnt,ddsup,
  992. x scalen,vcstat)
  993. endif
  994. c
  995. do i=1,mn
  996. scale(i)=scale(i)*scalen(i)
  997. enddo
  998. c
  999. write(buff,'(1x,a)')'Scaling done...'
  1000. call mprnt(buff)
  1001. return
  1002. end
  1003. c
  1004. c ============================================================================
  1005. c
  1006. subroutine scale1(bounds,rownzs,colpnt,obj,scale,
  1007. x vcstat,rowidx,rhs,work1,scpass,scdif,veclen,
  1008. x lognz)
  1009. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1010. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1011. common/numer/ tplus,tzer
  1012. real*8 tplus,tzer
  1013. real*8 bounds(mn),rownzs(cfree),obj(n),scale(mn),
  1014. x rhs(m),work1(mn),scdif,lognz(nz)
  1015. integer*4 rowidx(cfree),colpnt(n1),vcstat(mn),scpass,veclen(mn)
  1016. c
  1017. real*8 defic,odefic
  1018. integer*4 pass,i,j,pnt1,pnt2,nonz
  1019. character*99 buff
  1020. c
  1021. pass=0
  1022. nonz=0
  1023. defic= 1.0d+0
  1024. odefic=0.0d+0
  1025. do i=1,mn
  1026. veclen(i)=0
  1027. enddo
  1028. do i=1,n
  1029. if(vcstat(i).gt.-2)then
  1030. pnt1=colpnt(i)
  1031. pnt2=colpnt(i+1)-1
  1032. do j=pnt1,pnt2
  1033. if((abs(rownzs(j)).gt.tzer).and.
  1034. x (vcstat(rowidx(j)+n).gt.-2))then
  1035. lognz(j)=log(abs(rownzs(j)))
  1036. veclen(i)=veclen(i)+1
  1037. veclen(rowidx(j)+n)=veclen(rowidx(j)+n)+1
  1038. nonz=nonz+1
  1039. odefic=odefic+abs(lognz(j))
  1040. else
  1041. lognz(j)=0.0d+0
  1042. endif
  1043. enddo
  1044. endif
  1045. enddo
  1046. do i=1,mn
  1047. if(veclen(i).eq.0)veclen(i)=1
  1048. scale(i)=0.0d+0
  1049. enddo
  1050. if(nonz.eq.0)goto 999
  1051. odefic=exp(odefic/dble(nonz))
  1052. if(odefic.le.scdif)goto 999
  1053. 10 write(buff,'(1x,a,i2,a,d12.6)')'Pass',pass,'. Average def.',odefic
  1054. call mprnt(buff)
  1055. call sccol1(colpnt,scale,
  1056. x vcstat,rowidx,veclen,lognz)
  1057. pass=pass+1
  1058. call scrow1(rowidx,colpnt,work1,scale,vcstat,defic,veclen,lognz)
  1059. defic=exp(defic/dble(nonz))
  1060. if(defic.le.scdif)goto 999
  1061. if(pass.ge.scpass)goto 999
  1062. if(odefic.le.defic)goto 999
  1063. odefic=defic
  1064. goto 10
  1065. 999 write(buff,'(1x,a,i2,a,d12.6)')'Pass',pass,'. Average def.',defic
  1066. call mprnt(buff)
  1067. c
  1068. c Scaling
  1069. c
  1070. do i=1,mn
  1071. scale(i)=exp(scale(i))
  1072. enddo
  1073. do i=1,n
  1074. pnt1=colpnt(i)
  1075. pnt2=colpnt(i+1)-1
  1076. do j=pnt1,pnt2
  1077. rownzs(j)=rownzs(j)/scale(i)/scale(rowidx(j)+n)
  1078. enddo
  1079. obj(i)=obj(i)/scale(i)
  1080. bounds(i)=bounds(i)*scale(i)
  1081. enddo
  1082. do i=1,m
  1083. rhs(i)=rhs(i)/scale(i+n)
  1084. bounds(i+n)=bounds(i+n)/scale(i+n)
  1085. enddo
  1086. return
  1087. end
  1088. c
  1089. c ============================================================================
  1090. c
  1091. subroutine scrow1(rowidx,colpnt,
  1092. x maxi,scale,excld,ss,veclen,lognz)
  1093. c
  1094. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1095. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1096. c
  1097. real*8 lognz(nz),maxi(mn),scale(mn),ss
  1098. integer*4 rowidx(cfree),colpnt(n1),excld(mn),veclen(mn)
  1099. common/numer/ tplus,tzer
  1100. real*8 tplus,tzer
  1101. c ---------------------------------------------------------------------------
  1102. integer*4 i,j,pnt1,pnt2
  1103. real*8 sol
  1104. c ---------------------------------------------------------------------------
  1105. ss=0
  1106. do i=1,m
  1107. maxi(i)=0.0d+0
  1108. enddo
  1109. do i=1,n
  1110. if(excld(i).gt.-2)then
  1111. sol=scale(i)
  1112. pnt1=colpnt(i)
  1113. pnt2=colpnt(i+1)-1
  1114. do j=pnt1,pnt2
  1115. if(excld(rowidx(j)+n).gt.-2)then
  1116. maxi(rowidx(j))=maxi(rowidx(j))+lognz(j)-sol
  1117. ss=ss+abs(lognz(j)-sol-scale(rowidx(j)+n))
  1118. endif
  1119. enddo
  1120. endif
  1121. enddo
  1122. do i=1,m
  1123. scale(n+i)=maxi(i)/veclen(i+n)
  1124. enddo
  1125. return
  1126. end
  1127. c
  1128. c ===========================================================================
  1129. c
  1130. subroutine sccol1(colpnt,scale,
  1131. x excld,rowidx,veclen,lognz)
  1132. c
  1133. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1134. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1135. c
  1136. real*8 scale(mn),lognz(nz)
  1137. integer*4 colpnt(n1),excld(mn),rowidx(cfree),veclen(mn)
  1138. common/numer/ tplus,tzer
  1139. real*8 tplus,tzer
  1140. c ---------------------------------------------------------------------------
  1141. integer*4 i,j,pnt1,pnt2
  1142. real*8 ma
  1143. c ---------------------------------------------------------------------------
  1144. do i=1,n
  1145. ma=0.0d+0
  1146. if(excld(i).gt.-2)then
  1147. pnt1=colpnt(i)
  1148. pnt2=colpnt(i+1)-1
  1149. do j=pnt1,pnt2
  1150. ma=ma+lognz(j)-scale(rowidx(j)+n)
  1151. enddo
  1152. scale(i)=ma/veclen(i)
  1153. endif
  1154. enddo
  1155. return
  1156. end
  1157. c
  1158. c ===========================================================================
  1159. c
  1160. subroutine scrow2(rhs,bounds,rownzs,rowidx,
  1161. x colpnt,maxi,scale,excld)
  1162. c
  1163. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1164. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1165. c
  1166. common/numer/ tplus,tzer
  1167. real*8 tplus,tzer
  1168. c
  1169. real*8 rownzs(cfree),bounds(mn),rhs(m),maxi(m),scale(mn)
  1170. integer*4 rowidx(cfree),colpnt(n1),excld(mn)
  1171. c ---------------------------------------------------------------------------
  1172. integer*4 i,j,pnt1,pnt2,k
  1173. real*8 sol
  1174. c ---------------------------------------------------------------------------
  1175. do i=1,m
  1176. maxi(i)=0
  1177. enddo
  1178. do i=1,n
  1179. if(excld(i).gt.-2)then
  1180. pnt1=colpnt(i)
  1181. pnt2=colpnt(i+1)-1
  1182. do j=pnt1,pnt2
  1183. k=rowidx(j)
  1184. sol=abs(rownzs(j))
  1185. if (maxi(k).lt.sol)maxi(k)=sol
  1186. enddo
  1187. endif
  1188. enddo
  1189. do i=1,m
  1190. if(maxi(i).le.tzer)maxi(i)=1.0d+0
  1191. scale(n+i)=maxi(i)*scale(n+i)
  1192. rhs(i)=rhs(i)/maxi(i)
  1193. bounds(i+n)=bounds(i+n)/maxi(i)
  1194. enddo
  1195. do i=1,n
  1196. pnt1=colpnt(i)
  1197. pnt2=colpnt(i+1)-1
  1198. do j=pnt1,pnt2
  1199. k=rowidx(j)
  1200. rownzs(j)=rownzs(j)/maxi(k)
  1201. enddo
  1202. enddo
  1203. return
  1204. end
  1205. c
  1206. c ===========================================================================
  1207. c
  1208. subroutine sccol2(bounds,rownzs,colpnt,obj,scale,
  1209. x excld,rowidx)
  1210. c
  1211. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1212. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1213. c
  1214. real*8 rownzs(cfree),bounds(mn),obj(n),scale(mn)
  1215. integer*4 colpnt(n1),excld(mn),rowidx(cfree)
  1216. common/numer/ tplus,tzer
  1217. real*8 tplus,tzer
  1218. c ---------------------------------------------------------------------------
  1219. integer*4 i,j,pnt1,pnt2
  1220. real*8 sol,ma
  1221. c ---------------------------------------------------------------------------
  1222. do i=1,n
  1223. if(excld(i).gt.-2)then
  1224. ma=0
  1225. pnt1=colpnt(i)
  1226. pnt2=colpnt(i+1)-1
  1227. do j=pnt1,pnt2
  1228. if(excld(rowidx(j)+n).gt.-2)then
  1229. sol=abs(rownzs(j))
  1230. if (ma.lt.sol)ma=sol
  1231. endif
  1232. enddo
  1233. if (ma.le.tzer)ma=1.0d+0
  1234. scale(i)=ma*scale(i)
  1235. do j=pnt1,pnt2
  1236. rownzs(j)=rownzs(j)/ma
  1237. enddo
  1238. obj(i)=obj(i)/ma
  1239. bounds(i)=bounds(i)*ma
  1240. endif
  1241. enddo
  1242. return
  1243. end
  1244. c
  1245. c ===========================================================================
  1246. c
  1247. subroutine scalobj(obj,scobj,excld,objnor)
  1248. c
  1249. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1250. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1251. c
  1252. real*8 obj(n),scobj,objnor
  1253. integer*4 excld(n),i
  1254. character*99 buff
  1255. c ---------------------------------------------------------------------------
  1256. scobj=0.0d+0
  1257. do i=1,n
  1258. if(excld(i).gt.-2)then
  1259. if (abs(obj(i)).gt.scobj)scobj=abs(obj(i))
  1260. endif
  1261. enddo
  1262. scobj=scobj/objnor
  1263. if(scobj.lt.1.0d-08)scobj=1.0d-08
  1264. write(buff,'(1x,a,d8.2)')'Obj. scaled ',scobj
  1265. call mprnt(buff)
  1266. do i=1,n
  1267. obj(i)=obj(i)/scobj
  1268. enddo
  1269. return
  1270. end
  1271. c
  1272. c ===========================================================================
  1273. c
  1274. subroutine scalrhs(rhs,scrhs,excld,rhsnor,bounds,xs,up )
  1275. c
  1276. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1277. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1278. c
  1279. real*8 rhs(m),scrhs,rhsnor,bounds(mn),xs(mn),up(mn)
  1280. integer*4 excld(mn),i
  1281. character*99 buff
  1282. c ---------------------------------------------------------------------------
  1283. scrhs=0.0d+0
  1284. do i=1,m
  1285. if(excld(i+n).gt.-2)then
  1286. if(abs(rhs(i)).gt.scrhs)scrhs=abs(rhs(i))
  1287. endif
  1288. enddo
  1289. scrhs=scrhs/rhsnor
  1290. if(scrhs.lt.1.0d-08)scrhs=1.0d-08
  1291. write(buff,'(1x,a,d8.2)')'Rhs. scaled ',scrhs
  1292. call mprnt(buff)
  1293. do i=1,m
  1294. rhs(i)=rhs(i)/scrhs
  1295. enddo
  1296. do i=1,mn
  1297. bounds(i)=bounds(i)/scrhs
  1298. xs(i)=xs(i)/scrhs
  1299. up(i)=up(i)/scrhs
  1300. enddo
  1301. return
  1302. end
  1303. c
  1304. c ============================================================================
  1305. c Curtis-Reid Scaling algorithm
  1306. c ============================================================================
  1307. c
  1308. subroutine scale2(bounds,rownzs,colpnt,obj,sc,
  1309. x vcstat,rowidx,rhs,scpass,scdif,scm1,rk,logsum,count)
  1310. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1311. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1312. common/numer/ tplus,tzer
  1313. real*8 tplus,tzer
  1314. c
  1315. real*8 bounds(mn),rownzs(cfree),obj(n),sc(mn),
  1316. x rhs(m),scdif,scm1(mn),rk(mn),logsum(mn)
  1317. integer*4 rowidx(cfree),colpnt(n1),vcstat(mn),scpass,count(mn)
  1318. c
  1319. integer*4 i,j,in,pnt1,pnt2,pass
  1320. real*8 logdef,s,qk,qkm1,ek,ekm1,ekm2,sk,skm1
  1321. character*99 buff
  1322. c
  1323. pass=0
  1324. do i=1,mn
  1325. count(i)=0
  1326. logsum(i)=0.0d+0
  1327. enddo
  1328. logdef=0.0d+0
  1329. in=0
  1330. do i=1,n
  1331. if(vcstat(i).gt.-2)then
  1332. pnt1=colpnt(i)
  1333. pnt2=colpnt(i+1)-1
  1334. do j=pnt1,pnt2
  1335. if(vcstat(rowidx(j)+n).gt.-2)then
  1336. if(abs(rownzs(j)).gt.tzer)then
  1337. s=log(abs(rownzs(j)))
  1338. count(rowidx(j)+n)=count(rowidx(j)+n)+1
  1339. count(i)=count(i)+1
  1340. logsum(i)=logsum(i)+s
  1341. logsum(rowidx(j)+n)=logsum(rowidx(j)+n)+s
  1342. logdef=logdef+s*s
  1343. in=in+1
  1344. endif
  1345. endif
  1346. enddo
  1347. endif
  1348. enddo
  1349. do i=1,mn
  1350. if((vcstat(i).le.-2).or.(count(i).eq.0))count(i)=1
  1351. enddo
  1352. logdef=sqrt(logdef)/dble(in)
  1353. logdef=exp(logdef)
  1354. write(buff,'(1x,a,i2,a,d12.6)')'Pass',pass,'. Average def.',logdef
  1355. call mprnt(buff)
  1356. if(logdef.le.scdif)then
  1357. do i=1,mn
  1358. sc(i)=1.0d+0
  1359. enddo
  1360. goto 999
  1361. endif
  1362. c
  1363. c Initialize
  1364. c
  1365. do i=1,m
  1366. sc(i+n)=logsum(i+n)/count(i+n)
  1367. rk(i+n)=0
  1368. enddo
  1369. sk=0
  1370. do i=1,n
  1371. if(vcstat(i).gt.-2)then
  1372. s=logsum(i)
  1373. pnt1=colpnt(i)
  1374. pnt2=colpnt(i+1)-1
  1375. do j=pnt1,pnt2
  1376. s=s-logsum(rowidx(j)+n)/count(rowidx(j)+n)
  1377. enddo
  1378. else
  1379. s=0
  1380. endif
  1381. rk(i)=s
  1382. sk=sk+s*s/count(i)
  1383. sc(i)=0.0d+0
  1384. enddo
  1385. do i=1,mn
  1386. scm1(i)=sc(i)
  1387. enddo
  1388. ekm1=0
  1389. ek=0
  1390. qk=1.0d+0
  1391. c
  1392. c Curtis-Reid scaling
  1393. c
  1394. 10 pass=pass+1
  1395. do i=1,m
  1396. rk(i+n)=ek*rk(i+n)
  1397. enddo
  1398. do i=1,n
  1399. if(vcstat(i).gt.-2)then
  1400. pnt1=colpnt(i)
  1401. pnt2=colpnt(i+1)-1
  1402. s=rk(i)/count(i)
  1403. do j=pnt1,pnt2
  1404. if(vcstat(rowidx(j)+n).gt.-2)
  1405. x rk(rowidx(j)+n)=rk(rowidx(j)+n)+s
  1406. enddo
  1407. endif
  1408. enddo
  1409. skm1=sk
  1410. sk=0.0d+0
  1411. do i=1,m
  1412. rk(i+n)=-rk(i+n)/qk
  1413. sk=sk+rk(i+n)*rk(i+n)/count(i+n)
  1414. enddo
  1415. ekm2=ekm1
  1416. ekm1=ek
  1417. ek=qk*sk/skm1
  1418. qkm1=qk
  1419. qk=1-ek
  1420. if(pass.gt.scpass)goto 20
  1421. c
  1422. c Update Column-scale factors
  1423. c
  1424. do i=1,n
  1425. if(vcstat(i).gt.-2)then
  1426. s=sc(i)
  1427. sc(i)=s+(rk(i)/count(i)+ekm1*ekm2*(s-scm1(i)))/qk/qkm1
  1428. scm1(i)=s
  1429. endif
  1430. enddo
  1431. c
  1432. c even pass
  1433. c
  1434. do i=1,n
  1435. if(vcstat(i).gt.-2)then
  1436. s=ek*rk(i)
  1437. pnt1=colpnt(i)
  1438. pnt2=colpnt(i+1)-1
  1439. do j=pnt1,pnt2
  1440. if(vcstat(rowidx(j)+n).gt.-2)
  1441. x s=s+rk(rowidx(j)+n)/count(rowidx(j)+n)
  1442. enddo
  1443. s=-s/qk
  1444. else
  1445. s=0
  1446. endif
  1447. rk(i)=s
  1448. enddo
  1449. skm1=sk
  1450. sk=0.0d+0
  1451. do i=1,n
  1452. sk=sk+rk(i)*rk(i)/count(i)
  1453. enddo
  1454. ekm2=ekm1
  1455. ekm1=ek
  1456. ek=qk*sk/skm1
  1457. qkm1=qk
  1458. qk=1-ek
  1459. c
  1460. c Update Row-scale factors
  1461. c
  1462. do i=1,m
  1463. j=i+n
  1464. if(vcstat(j).gt.-2)then
  1465. s=sc(j)
  1466. sc(j)=s+(rk(j)/count(j)+ekm1*ekm2*(s-scm1(j)))/qk/qkm1
  1467. scm1(j)=s
  1468. endif
  1469. enddo
  1470. goto 10
  1471. c
  1472. c Syncronize Column factors
  1473. c
  1474. 20 do i=1,n
  1475. if(vcstat(i).gt.-2)then
  1476. sc(i)=sc(i)+(rk(i)/count(i)+ekm1*ekm2*(sc(i)-scm1(i)))/qkm1
  1477. endif
  1478. enddo
  1479. c
  1480. c Scaling
  1481. c
  1482. logdef=0
  1483. do i=1,mn
  1484. if(vcstat(i).gt.-2)then
  1485. sc(i)=exp(sc(i))
  1486. else
  1487. sc(i)=1.0d+0
  1488. endif
  1489. enddo
  1490. do i=1,n
  1491. pnt1=colpnt(i)
  1492. pnt2=colpnt(i+1)-1
  1493. do j=pnt1,pnt2
  1494. rownzs(j)=rownzs(j)/sc(i)/sc(rowidx(j)+n)
  1495. if((vcstat(rowidx(j)+n).gt.-2).and.
  1496. x (abs(rownzs(j)).gt.tzer))then
  1497. s=log(abs(rownzs(j)))
  1498. logdef=logdef+s*s
  1499. endif
  1500. enddo
  1501. obj(i)=obj(i)/sc(i)
  1502. bounds(i)=bounds(i)*sc(i)
  1503. enddo
  1504. do i=1,m
  1505. rhs(i)=rhs(i)/sc(i+n)
  1506. bounds(i+n)=bounds(i+n)/sc(i+n)
  1507. enddo
  1508. logdef=sqrt(logdef)/dble(in)
  1509. logdef=exp(logdef)
  1510. pass=pass-1
  1511. write(buff,'(1x,a,i2,a,d12.6)')'Pass',pass,'. Average def.',logdef
  1512. call mprnt(buff)
  1513. 999 return
  1514. end
  1515. c
  1516. c ============================================================================
  1517. c ===========================================================================
  1518. c
  1519. subroutine stlamb(colpnt,vcstat,rowidx,cnt,fixn,dropn,p)
  1520. c
  1521. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1522. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1523. c
  1524. integer*4 colpnt(n1),vcstat(mn),rowidx(nz),cnt(mn),
  1525. x fixn,dropn,p
  1526. c
  1527. common/factor/ tpiv1,tpiv2,tabs,trabs,lam,tfind,order,supdens
  1528. real*8 tpiv1,tpiv2,tabs,trabs,lam,tfind,order,supdens
  1529. c
  1530. common/setden/ maxdense,densgap,setlam,denslen
  1531. real*8 maxdense,densgap
  1532. integer*4 setlam,denslen
  1533. c
  1534. integer*4 i,j,pnt1,pnt2,cn,lcn,lcd,ndn,z,maxcn
  1535. real*8 la
  1536. character*99 buff
  1537. c
  1538. c ---------------------------------------------------------------------------
  1539. c
  1540. C CMSSW: Explicit initialization needed
  1541. ndn=0
  1542. write(buff,'(1X)')
  1543. call mprnt(buff)
  1544. do i=1,m
  1545. cnt(i)=0
  1546. enddo
  1547. if((m-dropn).ge.(n-fixn))then
  1548. cnt(1)=m-dropn-n+fixn
  1549. endif
  1550. maxcn=0
  1551. do i=1,n
  1552. if(vcstat(i).gt.-2)then
  1553. pnt1=colpnt(i)
  1554. pnt2=colpnt(i+1)-1
  1555. cn=0
  1556. do j=pnt1,pnt2
  1557. if(vcstat(rowidx(j)).gt.-2)cn=cn+1
  1558. enddo
  1559. if(cn.gt.0)cnt(cn)=cnt(cn)+1
  1560. vcstat(i)=cn
  1561. if(maxcn.lt.cn)maxcn=cn
  1562. endif
  1563. enddo
  1564. if(setlam.lt.0)goto 70
  1565. c
  1566. cn =maxcn
  1567. lcd=maxcn
  1568. lcn=maxcn
  1569. z=0
  1570. C CMSSW: Explicit integer conversion needed
  1571. pnt1=int((n-fixn+m-dropn)*maxdense)
  1572. pnt2=0
  1573. if((m-dropn).ge.1.5*(n-fixn))then
  1574. maxdense=1.0
  1575. endif
  1576. if((m-dropn).ge.2.5*(n-fixn))then
  1577. lcn=1
  1578. lcd=2
  1579. goto 60
  1580. endif
  1581. c
  1582. do while ((pnt2.le.pnt1).and.(cn.gt.0))
  1583. if(cnt(cn).eq.0)then
  1584. z=z+1
  1585. else
  1586. if(z.gt.0)then
  1587. if((densgap*cn*cn).le.(cn+z+1)*(cn+z+1))then
  1588. lcd=cn+z+1
  1589. lcn=cn
  1590. ndn=pnt2
  1591. endif
  1592. z=0
  1593. endif
  1594. pnt2=pnt2+cnt(cn)
  1595. endif
  1596. cn=cn-1
  1597. enddo
  1598. c
  1599. 60 write(buff,'(1X,A,I6)')'Largest sparse column length :',lcn
  1600. call mprnt(buff)
  1601. if((maxcn.le.denslen).or.(lcn.eq.maxcn))then
  1602. write(buff,'(1X,A)')'Problem has no dense columns'
  1603. call mprnt(buff)
  1604. lcn=maxcn
  1605. else
  1606. write(buff,'(1X,A,I6)')'Smallest dense column length :',lcd
  1607. call mprnt(buff)
  1608. write(buff,'(1X,A,I6)')'Number of dense columns :',ndn
  1609. call mprnt(buff)
  1610. endif
  1611. la=lcn+0.5
  1612. la=la/m
  1613. write(buff,'(1X,A,F7.4)')'Computed density parameter : ',la
  1614. call mprnt(buff)
  1615. if(la.gt.lam)then
  1616. lam=la
  1617. else
  1618. write(buff,'(1X,A,F7.4)') 'Parameter reset to value : ',lam
  1619. call mprnt(buff)
  1620. endif
  1621. 70 lam=lam*m
  1622. p=1
  1623. if((lam.ge.maxcn).and.(setlam.le.0))p=2
  1624. if(supdens.le.lam)supdens=lam
  1625. c
  1626. write(buff,'(1X)')
  1627. call mprnt(buff)
  1628. return
  1629. end
  1630. c
  1631. c ===========================================================================
  1632. c ===========================================================================
  1633. c
  1634. subroutine symmfo(inta1,pivots,ecolpnt,vcstat,
  1635. x colpnt,rowidx,rowpnt,colindex,perm,invperm,
  1636. x count,inta2,inta3,inta4,inta5,inta6,inta7,inta8,inta9,
  1637. x inta10,inta11,nonzeros,l,oper,tfind,inta12,code)
  1638. c
  1639. common/dims/ n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1640. integer*4 n,n1,m,mn,nz,cfree,pivotn,denwin,rfree
  1641. c
  1642. integer*4 inta1(mn),ecolpnt(mn),pivots(mn),vcstat(mn),
  1643. x colpnt(n1),rowidx(cfree),rowpnt(mn),colindex(rfree),
  1644. x perm(mn),invperm(mn),count(mn),inta2(mn),inta3(mn),inta4(mn),
  1645. x inta5(mn),inta6(mn),inta7(mn),inta8(mn),inta9(mn),inta10(mn),
  1646. x inta11(mn),tfind,inta12(mn),l,code
  1647. c
  1648. real*8 nonzeros(cfree),oper
  1649. c
  1650. integer*4 i,j,k,t1,tt1,t2,p1,p2,pnt,pnt1,pnt2,aatnz
  1651. character*99 buff
  1652. c
  1653. c ---------------------------------------------------------------------------
  1654. c
  1655. 1 format(1x,'Building aat time:',f9.2,' sec')
  1656. 2 format(1x,'Building ordering list time:',f9.2,' sec')
  1657. 4 format(1x,'Symbolic factorisation time:',f9.2,' sec')
  1658. 5 format(1x,'Total symbolic phase time:',f9.2,' sec')
  1659. 6 format(1x,'Sub-diagonal nonzeros in aat :',i9)
  1660. 7 format(1x,'Sub-diagonal nonzeros in L :',i9)
  1661. 8 format(1x,'NONZEROS :',i12)
  1662. 9 format(1x,'OPERATIONS :',f13.0)
  1663. 10 format(1x,'Minimum Local Fill-in Ordering with Power:',i3)
  1664. 11 format(1x,'Minimum Degree Ordering (Power=0)')
  1665. 12 format(1x,'Without Ordering')
  1666. c
  1667. call timer (tt1)
  1668. if(tfind.lt.0)then
  1669. write(buff,12)
  1670. else if(tfind.eq.0)then
  1671. write(buff,11)
  1672. else
  1673. write(buff,10)tfind
  1674. endif
  1675. oper=0.0d+0
  1676. call mprnt(buff)
  1677. do i=1,nz
  1678. rowidx(i)=rowidx(i)-n
  1679. enddo
  1680. if(rfree.lt.nz)then
  1681. write(buff,'(1x,a)')'Not enough integer memory'
  1682. call mprnt(buff)
  1683. code=-2
  1684. goto 999
  1685. endif
  1686. if(cfree.lt.2*nz)then
  1687. write(buff,'(1x,a)')'Not enough real memory'
  1688. call mprnt(buff)
  1689. code=-2
  1690. goto 999
  1691. endif
  1692. c
  1693. c If no ordering...
  1694. c
  1695. if(tfind.lt.0)then
  1696. t2=tt1
  1697. do i=1,m
  1698. perm(i)=i
  1699. enddo
  1700. goto 50
  1701. endif
  1702. c
  1703. c Otherwise...
  1704. c
  1705. do i=1,n
  1706. inta2(i)=i
  1707. enddo
  1708. call transps(n,m,nz,colpnt,rowidx,nonzeros,
  1709. x rowpnt,colindex,nonzeros(nz+1),inta2)
  1710. k=1
  1711. l=m
  1712. do i=1,m
  1713. pivots(i)=0
  1714. if(vcstat(i+n).le.-2)then
  1715. invperm(l)=i
  1716. l=l-1
  1717. else
  1718. invperm(k)=i
  1719. k=k+1
  1720. endif
  1721. enddo
  1722. call transps(m,n,nz,rowpnt,colindex,nonzeros(nz+1),
  1723. x colpnt,rowidx,nonzeros,invperm)
  1724. do i=1,n
  1725. p1=colpnt(i)
  1726. if(vcstat(i).le.-2)then
  1727. p2=colpnt(i)-1
  1728. else
  1729. p2=colpnt(i+1)-1

Large files files are truncated, but you can click here to view the full file