[J3] Why is += missing?
Jeff Hammond
jehammond at nvidia.com
Wed Aug 25 12:07:52 UTC 2021
I’m sure this is obvious to everyone else but I am new here.
After 15 years as a Fortran programmer, I am still annoyed on a daily basis about the tedium imposed on me because Fortran lacks +=.
One of countless examples is below. The duplication of snsi and sisn right and left of the = is not only tedious and wastes many columns – sorry, but many of my projects are still fixed source-form and enforce 72 column limits – but error prone since any manipulation of the array indices must be done twice.
do ii=1,nocc
do l=1,nfl
do j=1,nfj
do i=ilo,ihi
do k=klo,khi
int1=eri1(l,k,j,i)*factor
int2=eri2(j,k,l,i)*factor
snsi(i,j,l,ii)=snsi(i,j,l,ii)+t1ao(k,ii)*int1
snsi(k,j,l,ii)=snsi(k,j,l,ii)+t1ao(i,ii)*int2
sisn(k,l,j,ii)=sisn(k,l,j,ii)+t1ao(i,ii)*int1
sisn(i,l,j,ii)=sisn(i,l,j,ii)+t1ao(k,ii)*int2
enddo
enddo
enddo
enddo
enddo
I have not kept track but I suspect I’ve wasted many hours of my life debugging copy-and-paste errors related to the fact that I cannot do the obvious thing and use +=.
I am very curious what benefit the Fortran community has derived from the lack of support for += that justifies my suffering.
Thanks,
Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210825/8bd79e42/attachment.htm>
More information about the J3
mailing list