[J3] Why is += missing?
Jeff Hammond
jehammond at nvidia.com
Wed Aug 25 12:36:50 UTC 2021
Yes, although I’m not going to fight for “**=”.
NWChem has a few thousand instances where += and -= would be used.
Jeff
From: Klemm, Michael <Michael.Klemm at amd.com>
Date: Wednesday, August 25, 2021 at 3:33 PM
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Jeff Hammond <jehammond at nvidia.com>
Subject: RE: Why is += missing?
External email: Use caution opening links or attachments
[Public]
I guess for completeness you would also like to see the other variants such -=, *=, etc.?
Kind regards,
-michael
From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Jeff Hammond via J3
Sent: Wednesday, August 25, 2021 14:08
To: General J3 interest list <j3 at mailman.j3-fortran.org>
Cc: Jeff Hammond <jehammond at nvidia.com>
Subject: [J3] Why is += missing?
[CAUTION: External Email]
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/dcceeba2/attachment.htm>
More information about the J3
mailing list