home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4355 < prev    next >
Encoding:
Text File  |  1992-11-18  |  1.5 KB  |  40 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!uimrl7.mrl.uiuc.edu!ercolessi
  3. From: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  4. Subject: Re: 3d to 2d mapping
  5. References:  <BxxnCt.5M0@cs.dal.ca>
  6. Message-ID: <Bxxv0r.Anq@news.cso.uiuc.edu>
  7. Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
  8. Reply-To: ercolessi@uimrl3.mrl.uiuc.edu (furio ercolessi)
  9. Organization: MRL - UIUC
  10. Distribution: na
  11. Date: Thu, 19 Nov 1992 01:05:13 GMT
  12. Lines: 26
  13.  
  14. In article <BxxnCt.5M0@cs.dal.ca>, glenn@ug.cs.dal.ca (Glenn McCarville) writes:
  15. |>I want to take a 3 dimensional array and map it onto a 2d array.
  16. |>i.e. Set B(i,j)=A(x,i,j) for all i,j and x is some constant. Can this
  17. |>be done easily? 
  18.  
  19. the easiest way, if you can do it, is to transpose the array so as
  20. to have the constant index in the last position.
  21.  
  22. then you can
  23.     call blas_routine(A(1,1,x),...)
  24. where blas_routine expects a 2d array.
  25.  
  26. in fact, what is passed to the routine is the address of the specified
  27. element of the array, which the routine takes as starting address.
  28. data are stored in columnwise order, so this does exactly what you
  29. want.
  30.  
  31. if you cannot reorder the indexes, i'm afraid you have to copy
  32. the data into a temporary subarray. 
  33.  
  34. furio  
  35. --
  36. Furio Ercolessi
  37. Materials Research Laboratory           |   Intl School for Advanced Studies
  38. Univ. of Illinois at Urbana-Champaign   |   Trieste, Italy
  39. furio@uiuc.edu                          |   furio@sissa.it
  40.