Re: passing only the real parts of a complex array to a function
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 19:19:12 +0000 (UTC)
Kamaraju Kusumanchi <kk288@xxxxxxxxxxx> wrote:
(snip)
call increment(real(b, DP))(snip)
subroutine increment(p)
implicit none
real(DP) :: p(3)
p(:) = p(:) + 1.0_DP
end subroutine increment
When a subroutine is called with an expression instead
of a variable (scalar or array) the called routine can't
change the argument, and even if it was allowed, that wouldn't
change the components of the expression.
Even PL/I pseudo-variables won't do this, though you
can do some other interesting things with IMAG() in PL/I, one
of my favorite being a DO variable:
X=0;
DO imag(x)=1 TO 100;
PUT SKIP LIST(X,SQRT(X));
END;
in PL/I will print a table of square roots of imaginary
numbers, but it won't work as a subroutine argument.
(At least I don't think it will.)
Use a temporary array, assign the values to it, pass that
array, and then get the returned values out.
-- glen
.
- References:
- passing only the real parts of a complex array to a function
- From: Kamaraju Kusumanchi
- passing only the real parts of a complex array to a function
- Prev by Date: passing only the real parts of a complex array to a function
- Next by Date: Re: passing only the real parts of a complex array to a function
- Previous by thread: passing only the real parts of a complex array to a function
- Next by thread: Re: passing only the real parts of a complex array to a function
- Index(es):
Relevant Pages
|