Skip to content

Commit

Permalink
fix implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kent0 committed Mar 31, 2024
1 parent 321665e commit 1d46c05
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions code/batch.f
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,22 @@ subroutine breduce(a,n,m)
real a(n)

m = min(m,lbat)
i=1

k = n / m
if (n.ne.k*m) k=k+1
m = n / k

nrem = n - k*m

do while (i.le.n)
ngop=m
if (i.le.nrem) ngop=ngop+1
call gop(a(i),w,'+ ',ngop)
i=i+ngop
ia=1
do i=1,k-nrem
call gop(a(ia),w,'+ ',m)
ia=ia+m
enddo

do i=1,nrem
call gop(a(ia),w,'+ ',m+1)
ia=ia+m+1
enddo

return
Expand Down

0 comments on commit 1d46c05

Please sign in to comment.