Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!caen!news.cs.indiana.edu!ariel.unm.edu!triton.unm.edu!prentice From: prentice@triton.unm.edu (John Prentice) Newsgroups: comp.lang.fortran Subject: vectorization question Message-ID: <1991Mar29.141313.7418@ariel.unm.edu> Date: 29 Mar 91 14:13:13 GMT Organization: University of New Mexico, Albuquerque, NM Lines: 38 Originator: prentice@triton.unm.edu Consider the following loop: do 30 k=1,kmax do 20 j=1,jmax do 10 i=1,imax a(i,j,k)=... 10 continue 20 continue 30 continue On the Cray, only the inner most loop will vectorize. Does anyone have a suggestion for how to collapse this loop while still using the three dimensional array? In other words, I need a vectorized equivalent to: i=0 j=1 k=1 do 10 n=1,imax*jmax*kmax i=i+1 if (i.gt.imax) then i=1 j=j+1 if (j.gt.jmax) then j=1 k=k+1 endif endif a(i,j,k)=... 10 continue Any suggestions would be welcomed. Thanks. John -- John K. Prentice john@unmfys.unm.edu (Internet) Dept. of Physics and Astronomy, University of New Mexico, Albuquerque, NM, USA Computational Physics Group, Amparo Corporation, Albuquerque, NM, USA