Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven!uvaarpa!murdoch!astsun7.astro.Virginia.EDU!gl8f From: gl8f@astsun7.astro.Virginia.EDU (Greg Lindahl) Newsgroups: comp.lang.fortran Subject: Re: Fortran vs. C for numerical work (SUMMARY) Message-ID: <1990Nov30.163222.1376@murdoch.acc.Virginia.EDU> Date: 30 Nov 90 16:32:22 GMT References: <17680:Nov2806:04:1090@kramden.acf.nyu.edu> <109378@convex.convex.com> <10444:Nov3008:15:4590@kramden.acf.nyu.edu> Sender: news@murdoch.acc.Virginia.EDU Organization: Department of Astronomy, University of Virginia Lines: 16 In article <10444:Nov3008:15:4590@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >Now instead of adding (i * N * P + k) * sizeof(double) to the base of a, >the compiler will add i * sizeof(ptr) to the base of b, access that >value, and add k * sizeof(double) to that. However, the first expression is a constant. So you only have to do the multiplication once. One multiplication is often faster than N memory references. >But in Fortran you can't do this optimization, because you can't store >that array of pointers. The *compiler* isn't can. The compiler could build an array of pointers and use it inside loops which do "random" accesses. I suggested this yesterday, I guess you missed it ;-)