Hi David,

while I suffer from the same type of dyslexia (even after all these
years I still have trouble getting the indices right and frequently
have to sketch what the layout of the data is and what it should be,
using Fortran, C and a couple of other languages), I must point out
that plsurf3d uses the _C_ ordering. You can see this for yourself
in bindings/f(77|95)/sc3d.c which contains the Fortran-callable wrapper
for that function. There the array z is transposed to fill the temporary
array temp.

(I hope I do remember this correctly: the Fortran ordering is called
column-major and C ordering is called row-major.)

Regards,

Arjen

On 2010-01-06 09:11, David MacMahon wrote:
> As I said in an earlier message, I'm working on Ruby bindings to  
> PLplot that are analogous to the Ruby bindings to PGPLOT.  Like the  
> PGPLOT Ruby bindings, I've chosen to use/support the Ruby "NArray"  
> extension (http://narray.rubyforge.org/) for data arrays.  I just  
> implemented the plsurf3d function and it works great, but...
> 
> NArray stores 2D data (like the z data for plsurf3d) in a nx*ny  
> element 1D array in (I think) FORTRAN ordering (I think it's known as  
> "column major" ordering, but I always seem to suffer from row/column  
> dyslexia when it comes to remembering which is which).  So to get the  
> plots in example 8 to look right, I have to index the NArray z data  
> as z[j,i] rather than z[i,j] (where i is the index in the "x  
> dimension" and j is the index in the "y dimension").  I also have to  
> dimension the z array "backwards" (so I can use the indexes  
> "backwards").
> 
> To interface NArray's 2D data with plsurf3d, I have to allocate and  
> populate an array of nx pointers to arrays of ny values.  Since the y  
> values have to be contiguous in memory for plsurf3d, using the  
> "backwards" indexing scheme (perhaps "pre-transposed" is a more apt  
> term?) with NArray's 2D data saves a lot of memory copying.
> 
> While this is a little odd feeling, I don't think this will be a  
> "problem" per se, so the following is a low priority feature  
> request:  It would be nice if plsurf3d (and presumably other 3D  
> functions that I haven't gotten to yet) supported an option (e.g.  
> "TRANSPOSED_Z") that would indicate z is being given as an array of  
> ny pointers to arrays of nx values rather than the other way around.
> 
> Is there some existing way to accomplish the same thing?  How does  
> the FORTRAN interface to plsurf3d work?
> 
> Thanks,
> Dave
> 
> 
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> Plplot-devel mailing list
> Plplot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/plplot-devel
> 

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to