Re: gfortran & adjustable array: most values remain zero
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 20 Oct 2008 11:26:30 -0700
Ingo Thies <ingo.thies@xxxxxx> wrote:
Richard Maine wrote:
I suspect that the OP somehow expected that the dummy index values would
correspond to the actual ones. That's closer an f90-like feature
(assumed-shape dummy arrays). With f77 (and the f77-compatible forms in
f90), the dimension information is not communicated between the actual
and dummy arrays at all.
What exactly do you mean with "dummy index values"? Do you mean the
nx,ny that are transferred to the subroutine?
No, nx and ny are the dimensions, which is to say the limits for the
index values. The index values are the values of ix and iy in your
sample.
Indeed I expected that adjustable arrays would work in 2D (*,*) the same
way as in 1D (*), i.e. that the first 10 columns of the first 10 rows
would be filled. If this is not the case then one has to conclude that
adjustable arrays of more than one dimension should be generally avoided
since they won't work as expected in most cases.
There is no such dimension as (*,*). The * form is allowed only for the
last dimension (which is the only dimension in 1-d). Since there is no
such form, any conclusion about how the non-existent form works is moot.
Your understanding in any case is incorrect. There is *NO* form in f77
that works anything close to that. That is much closer to how
assumed-shape works in f90, but assumed shape is declared with (:,:),
not (*,*).
You seem to be confusing several things. Adjustable arrays of any rank
are fine. But..
1. The * syntax is not an adjustable array. The syntax used in your code
is. Perhaps you meant the * to stand for other syntax. But since * is an
actual Fortran syntax, that confuses things.
2. In order for things to work "reasonably", you have to make the
adjustable array dimensions be the same as the actual.
I tried to describe things in my previous post, but I don't think I
sucessfully communicated it. In any case, no, there is no form in f77
that will take the first 10 columns and the first 10 rows. You can do
that in f90, but not in f77. In f77, the actual and dummy arrays don't
even "know" what the columns and rows of the other are. All they know is
that there is a sequence of elements. They have no indication of what
row and column a particular element came from. The actual and dummy
arguments *INDEPENDENTLY* (I emphasize the word for a reason - it is
critical) determine how the elements in the sequence map to index
values. If you make the dimensions of the actual and dummy arrays match,
then those independent mappings will match and all will look sensible.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: gfortran & adjustable array: most values remain zero
- From: Ingo Thies
- Re: gfortran & adjustable array: most values remain zero
- References:
- gfortran & adjustable array: most values remain zero
- From: Ingo Thies
- Re: gfortran & adjustable array: most values remain zero
- From: mecej4
- Re: gfortran & adjustable array: most values remain zero
- From: Richard Maine
- Re: gfortran & adjustable array: most values remain zero
- From: Ingo Thies
- gfortran & adjustable array: most values remain zero
- Prev by Date: Re: gfortran & adjustable array: most values remain zero
- Next by Date: System-call problem
- Previous by thread: Re: gfortran & adjustable array: most values remain zero
- Next by thread: Re: gfortran & adjustable array: most values remain zero
- Index(es):
Relevant Pages
|