Fortran 90 allows indirect addressing, however if,
INTEGER, DIMENSION(4) :: A = 1, B = 2 INTEGER, DIMENSION(3) :: W = (/1,2,2/)
then writing
A(W) = A(W) + 2*B(1:3)
is incorrect due to the multiple assignments to A(2). We are able to use combining scatter functions:
A = SUM_SCATTER(2*B(1:3),A,W)
now A equals (/5,9,1,1/). This performs
A(1) = A(1) + 2*B(1) A(2) = A(2) + 2*B(2) + 2*B(3)
For more information, click here