Hi Jan,
That looks like the right technique. Thanks,
-robert
J. van Oosterwijk writes:
> Hello all,
>
> > [log in to unmask] writes:
> > > What I would really like is a way to point a complex array at real and
> > > imaginary components, and vice-versa. That would eliminate all data
> > > motion. That was the game we could play in F77. A real array with
> > > size 2*N could be passed to a subroutine and received as a complex
> > > array of size N.
>
> This is, indeed, not legal. So to make it legal, equivalence the
> real and complex array in the calling program unit. Equivalence,
> though discouraged by many, is still legal. Make the dummy
> a target, real, dimension(2*N), and use pointers in the procedure
> to separate real and imaginary part:
>
> real, pointer, dimension(:) :: im, re
>
> re => x(1::2)
> im => x(2::2)
>
> > > I cannot think of any legal way to do this in F90, but I wish it
> > > were possible.
> >
> > I cannot find anything in the f77 standard that allowed this. In
> > 15.6.2.3 of the f77 standard, I see
> >
> > "The actual arguments in a subroutine reference must agree in order,
> > number, and type with the corresponding dummy arguments..."
> >
> > I can't see anywhere that an exception to this is mentioned. You
> > could presumably equivalence the real to a complex array (assuming
> > that the real wasn't a dummy - because you can't equivalence to
> > dummies) and then pass that real array, but I don't see anything that
> > allows you to directly pass a real to a complex or vice versa.
> > What you might have been able to get by with in many compilers is
> > another question, but anything in this area that was legal in f77
> > remains legal in f90.
> >
> > There are, admitedly, things you might want to do in f90. For
> > example, you might want to use an allocatable or pointer array
> > (which you can't equivalence to). But again, that's not directly
> > something that was legal in f77 and now illegal in f90.
> >
>
> /---
> Jan van Oosterwijk
>
|