From: Alan W. I. <ir...@be...> - 2001-12-03 21:02:38
|
First to clarify, the current plimage has a first argument that is addressed as z(iy, ix) in fortran or z[ix][iy] in C. i.e., the row index iy is changing the most rapidly in both cases for a slower-changing column-index ix. So the current memory layout for images, whether fortran or C, corresponds to scanning the image along the columns (i.e., with the row index changing the most rapidly). I was (see below) proposing to change that to z(ix, iy) in fortran or z[iy][ix] in C so the memory layout would correspond to scanning the image along the rows (i.e., with column index changing the most rapidly) to be consistent with the way external libraries organize their images within memory. But you have brought up a good point. Apparently, for other two-dimensional arrays (see, e.g., the documentation for plshades, plcont, or plot3d) the array is organized like z[ix][iy] in C and z(iy,ix) in Fortran. I agree this organization seems a little more logical from the Fortran perspective and the way an array z_i_j is layed out in most textbooks with the first index corresponding to moving along a column (although I have seen a textbook with the opposite convention!). Thus, if the first argument of plimage is reordered in the way I was advocating, the array would have to be reordered (with page faults and cache faults) to process it with any other plplot function. Thus, you are moving from a medium problem to a much larger one with internal inconsistencies. Thus, I withdraw the proposal. The other alternative is to swap indices for *every* two-dimensional array in plplot, but that is an enormous task and changes the API for all our external users as well. I expect that will never happen so we will have to continue to live with the present arrangement of indices (which is probably a bit of a shock to our C users). Alan email: ir...@be... phone: 250-727-2902 FAX: 250-721-7715 snail-mail: Dr. Alan W. Irwin Department of Physics and Astronomy, University of Victoria, P.O. Box 3055, Victoria, British Columbia, Canada, V8W 3P6 __________________________ Linux-powered astrophysics __________________________ On Mon, 3 Dec 2001, [iso-8859-1] T C wrote: > Dear Alan, > > I suspect that the indexing maybe a hangover from the > original plplot fortran code where arrays are stored > in column major order as opposed to C where arrays > are row major. > > Regards > > Terrence > > ps the offset problems may also come from old fortran > code where arrays indices start from 1 > > > ________________________________________________________________ > Nokia 5510 looks weird sounds great. > Go to http://uk.promotions.yahoo.com/nokia/ discover and win it! > The competition ends 16 th of December 2001. > > _______________________________________________ > Plplot-devel mailing list > Plp...@li... > https://lists.sourceforge.net/lists/listinfo/plplot-devel > |