9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

csf remove do while loops

This commit is contained in:
Yann Damour 2022-03-24 16:14:31 +01:00
parent 22b28fc774
commit 8a759e6a94

View File

@ -51,16 +51,24 @@
if(cfg_seniority_index(i+2) > ncfgpersomo) then if(cfg_seniority_index(i+2) > ncfgpersomo) then
ncfgpersomo = cfg_seniority_index(i+2) ncfgpersomo = cfg_seniority_index(i+2)
else else
k = 0 ! l = i+k+2
if ((i+2+k) < size(cfg_seniority_index,1)) then ! Loop over l with a constraint to ensure that l <= size(cfg_seniority_index,1)-1
do while(cfg_seniority_index(i+2+k) < ncfgpersomo) ! Old version commented just below
k = k + 2 do l = min(size(cfg_seniority_index,1)-1, i+2), size(cfg_seniority_index,1)-1, 2
if ((i+2+k) >= size(cfg_seniority_index,1)) then if (cfg_seniority_index(l) >= ncfgpersomo) then
exit ncfgpersomo = cfg_seniority_index(l)
endif endif
ncfgpersomo = cfg_seniority_index(i+2+k) enddo
enddo !k = 0
endif !if ((i+2+k) < size(cfg_seniority_index,1)) then
! do while(cfg_seniority_index(i+2+k) < ncfgpersomo)
! k = k + 2
! if ((i+2+k) >= size(cfg_seniority_index,1)) then
! exit
! endif
! ncfgpersomo = cfg_seniority_index(i+2+k)
! enddo
!endif
endif endif
endif endif
ncfg = ncfgpersomo - ncfgprev ncfg = ncfgpersomo - ncfgprev
@ -79,16 +87,26 @@
if(cfg_seniority_index(i+2) > ncfgprev) then if(cfg_seniority_index(i+2) > ncfgprev) then
ncfgprev = cfg_seniority_index(i+2) ncfgprev = cfg_seniority_index(i+2)
else else
k = 0 ! l = i+k+2
if ((i+2+k) < size(cfg_seniority_index,1)) then ! Loop over l with a constraint to ensure that l <= size(cfg_seniority_index,1)-1
do while(cfg_seniority_index(i+2+k) < ncfgprev) ! Old version commented just below
k = k + 2 do l = min(size(cfg_seniority_index,1)-1, i+2), size(cfg_seniority_index,1)-1, 2
if ((i+2+k) >= size(cfg_seniority_index,1)) then print*,'l'
exit if (cfg_seniority_index(l) >= ncfgprev) then
endif ncfgprev = cfg_seniority_index(l)
ncfgprev = cfg_seniority_index(i+2+k) endif
enddo print*,'ncfgprev', ncfgprev
endif enddo
!k = 0
!if ((i+2+k) < size(cfg_seniority_index,1)) then
! do while(cfg_seniority_index(i+2+k) < ncfgprev)
! k = k + 2
! if ((i+2+k) >= size(cfg_seniority_index,1)) then
! exit
! endif
! ncfgprev = cfg_seniority_index(i+2+k)
! enddo
!endif
endif endif
enddo enddo
END_PROVIDER END_PROVIDER