Path: utzoo!attcan!uunet!decwrl!apple!bionet!ames!uhccux!virtue!comp.vuw.ac.nz!munnari.oz.au!mudla!ok From: ok@mudla.cs.mu.OZ.AU (Richard O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: What is the FORTRAN for ? Keywords: FORTRAN, stupidity Message-ID: <4923@munnari.oz.au> Date: 27 Jul 90 12:53:50 GMT References: <1990Jul25.174153.16896@ecn.purdue.edu> <14448@lambda.UUCP> <7404@drydock.cray.com> Sender: news@cs.mu.oz.au Lines: 29 In article <7404@drydock.cray.com>, jot@drydock.cray.com (Otto Tennant) writes: > One of the key facctors is multi-dimensional array processing. > In many languages, a multi-dimensional array is not a "first-class" > object. Instead, a two dimensional array is a vector of vectors, > and so on. > This means that there is a preferred direction for vecttorization. Ahem. Not to knock Fortran, _but_ arrays are not first-class objects in Fortran 77, not like they are in Lisp or APL or Pop or Scheme. It has historically been the case that Fortran users _knew_ that "arrays are stored in column-major order", and if you have arrays which are large compared with your system's page size, it _still_ pays you to access Fortran arrays in the "easy" direction, e.g. DO 10 ICOL = 1, N DO 20 IROW = 1, M use A(IROW, ICOL) !IROW varies "faster" 20 CONTINUE 10 CONTINUE What if any difference this makes to vectorisation depends on how well your system handles non-unity strides. I _have_ encountered a compiler which could vectorise DO 10 ICOL = 1, N DO 20 IROW = 1, M A(IROW,ICOL) = B(IROW,ICOL) + C(IROW,ICOL) 20 CONTINUE 10 CONTINUE but if you switched the nesting of the DO statements it wouldn't.