Renchi Raju wrote:
> yes. (this was actually a surprise to me when i initially encountered
> this).
Let me just add: You can pass the lower bounds you want explicitly, or
use an array pointer (which will preserve bound info accross calls).
See example below (module array name cannot start with 2).
While this is suprising and a different approach could be taken
(especially since most, if not all implementations, pass a full
descriptor anyway), it makes a lot of operations easier. For example,
the indexing inside subroutine A below is simplified, and in many cases
a matrix procedure does not really care about the lower bounds anyway.
Best,
Aleksandar
program main
implicit none
real, dimension(-1:8, 0:5) :: main_array
....
call A(lbound(main_array),main_array)
....
contains
subroutine A (lb,2D_array)
integer, dimension(2), intent(in) :: lb
real, dimension(lb(1):,lb(2):), intent( inout ) :: 2D_array
....
! transformations carried out on 2D_array
....
end subroutine A
....
....
end program
|