home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3211 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.6 KB

  1. Path: sparky!uunet!mcsun!corton!molene!brutus!molagnon
  2. From: molagnon@brutus.ifremer.fr (Michel Olagnon, Ifremer DITI GO, 98.22.41.44)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: F77, array passing question, dimensions.
  5. Message-ID: <1992Aug27.095851.14372@molene.ifremer.fr>
  6. Date: 27 Aug 92 09:58:51 GMT
  7. References: <1992Aug26.032018.20430@news.clarkson.edu>
  8. Sender: news@molene.ifremer.fr
  9. Reply-To: molagnon@brutus.ifremer.fr
  10. Organization: Ifremer
  11. Lines: 36
  12.  
  13. In article 20430@news.clarkson.edu, russell@sun.soe.clarkson.edu (David Russell) writes:
  14. >
  15. >   Given an array dimensioned to lets say 10 in a calling routine,
  16. >and given the fact that only the first three values are needed in
  17. >the called routine, is there any advantage or disadvantage to
  18. >dimensioning the array to only 3 in the called routine.
  19. >
  20. >....
  21. >
  22. >ie. Is there any savings in time, space, performance,......
  23. >--
  24.  
  25. Many of the Fortran compilers that I have known show dramatic improvement
  26. when I/O is performed on the array in the called routine, thus needing no
  27. implied do-loop.
  28. My programs often replace
  29.   write (lu) (x (i), i=1, n)
  30. with
  31.   call wrtsub (lu, x, n)
  32.   ....
  33.   end
  34.   subroutine wrtsub (lu, x, n)
  35.   real x (n)
  36.   write (lu) x
  37.   return
  38.   end
  39.  
  40. For large n, I had cutdowns by a factor of 6.
  41.  
  42. Of course, another advantage may be array-bound checking in debugging the subroutine.
  43.  
  44. ---
  45. | Michel OLAGNON            | EMAIL : Michel.Olagnon@ifremer.fr  |
  46. | IFREMER - Centre de Brest |                                    |
  47. | B.P. 70                   | PHONE : +33  98 22 41 44           |
  48. | F-29280 PLOUZANE - FRANCE | FAX   : +33  98 22 41 35           |
  49.