Basic HTML version of Foils prepared 17 Sept 1996

Foil 60 SUM, SUM_PREFIX and SUM_SCATTER defined

From New CPS615HPF and Fortran90 Discussion Sept 17 96 Basic Simulation Track for Computational Science CPS615 -- Fall Semester 96. by Geoffrey C. Fox, Tom Haupt


X=SUM(A) sums all elements of A and places result in scalar X
Y = SUM_PREFIX(A) sets array Y of same size as A so that Y(i) has the sum of all A(j) for 1 <= j <= i
Y = SUM_SCATTER(A,B, IND) sets array element Y(i) as the sum of array element B(i) plus those elements of A(j) where IND(j) = I
  • X = SUM_SCATTER( flux, X, INDEX) is equivalent to
  • FORALL (i=1:N)
    • X(INDEX(i)) = X(INDEX(i)) + flux(i)
  • END FORALL assuming INDEX(i) just permutes numbers 1 to N and has no repeated values



© on Tue Oct 7 1997