On Wed, 2010-01-06 at 22:29 -0500, Robert G. Brown wrote: > However, some of my beowulfish friends who work(ed) > for compiler companies argued that one of Fortran's longstanding > advantages in numerical code efficiency is simply because of the fact > that matrices in Fortran are written in stone and so compiler writers > can optimize the hell out of them. C pointers, OTOH -- well,
I think the main difference is that fortran can assume no aliasing, which allows some extra optimization that C cannot do. The new 'restrict' keyword is supposed to help with this, but we'll see. > I've written code to do so many times -- Numerical Recipes provides the > basic idea in its matrix-packing routines. Simply allocate e.g. > > double **..*m,*v; I understand the mechanics of it. I'm not sure what my concern was; I thought about this a few months ago and decided there was some semantic problem. But it looks like the **..*m has exactly the same life-cycle and maintenance as *v, so I'm not sure what I was thinking. It might come back to me. > I can probably dig this code out and post it here (or post a link to it) > if you want to look at it. I think I went up to 9 or 10 dimensions (way > more than I needed) and did a lot of things via brute force to make the > purely mechanical recursion obvious; I planned an eventual rewrite into > a more compact form that I never got around to. Sure. Feel free to post it. I like to look at everything and cherry-pick the best parts from other people's stuff. Makes things a lot easier. -- G. Jungman
