Re: gfortran & adjustable array: most values remain zero



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
.



Relevant Pages

  • Re: Pros and cons of assumed-shape arrays
    ... dimension relations. ... In most subroutines with several arrays as ... arguments almost all of the arrays have similar shapes. ... is loop invariant and will be done once in the loop preamble ...
    (comp.lang.fortran)
  • Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
    ... Dimension xbys, rbys ... calculated integer numerical constant ... You can only dimension arrays passed as arguments with nPlns, ... You could always join the 21st century and follow Ron Shepard's suggestion, but you'll have to follow it carefully. ...
    (comp.lang.fortran)
  • Two dimensional arrays "C question"
    ... My question has to do with two dimensional arrays. ... int main ... So we see that the compiler can automatically calculate the first dimension. ...
    (microsoft.public.vc.language)
  • Re: CheckedListbox
    ... Dim MyInt(,) - Verschlechterung? ... Das Problem ist ich kann immer nur die letzte Dimension verändern, ... Man kann überhaupt keine Dimension eines Arrays verändern. ... Falls du auf Redim Preserve anspielst: ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: some confusing in subroutine
    ... >> This is an ancient and truly hairy kludge to get around the fact ... fortran has always allowed dummy arrays to be declared with ... > arrays as ...
    (comp.lang.fortran)