Quantcast
Channel: Intel® Fortran Composer XE
Viewing all articles
Browse latest Browse all 1424

Local arrays

$
0
0

Hello!

I have some subroutines like this:

pure subroutine Sub1( X, Y )
  real, intent(in) :: X(:)
  real, intent(out) :: Y(:)
    real Z(SIZE(X))
      ....
end subroutine

pure subroutine Sub2( X, Y, n )
  real, intent(in) :: X(:)
  real, intent(out) :: Y(:)
  integer, intent(in) :: n
    real Z(n)
      ....
end subroutine

pure subroutine Sub3( X, Y, n )
  real, intent(in) :: X(:)
  real, intent(out) :: Y(:)
    real Z(100)
      ....
end subroutine

In subroutine Sub3 array Z will be static as i know. But what about Sub1 and Sub2 ?  Will the array Z in Sub1 and Sub2 be allocated each time when the subroutine is calling and will the speed of execution of Sub1 or Sub2 be decreased compared with Sub3?

thank you


Viewing all articles
Browse latest Browse all 1424

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>