Re: dimension question
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Sun, 25 Feb 2007 10:16:56 -0800
Michael Metcalf wrote:
(snip)
Since you have a f95 compiler, might I suggest that you learn Fortran 95 rather than Fortran 77. The solution to your problem is then to use an assumed-shape array:
(snip)
With assumed shape the subroutine can find out the actual size of
the array, and use that.
subroutine test(a)
real a(:, :)
integer i,j
do i=1,size(a,2)
print *, (a(j,i),j=1,size(a,1))
end subroutine test
If you require a square array compare size(a,1) and size(a,2)
and complain appropriately. For assumed shape it is still faster
to have the leftmost subscript vary faster, as above. In this
case the a in the subroutine is in non-contiguous storage, which
may be slower.
-- glen
.
- References:
- dimension question
- From: sc
- Re: dimension question
- From: Michael Metcalf
- dimension question
- Prev by Date: Re: dimension question
- Next by Date: Re: dimension question
- Previous by thread: Re: dimension question
- Next by thread: Re: dimension question
- Index(es):
Relevant Pages
|
|