Re: Efficient way to pass different shaped arrays?
- From: harper@xxxxxxxxxxxxx (John Harper)
- Date: 30 Jun 2006 10:24:22 +1200
In article <c5qdndEDAoKZkD7ZnZ2dnUVZ_u-dnZ2d@xxxxxxxxxxx>,
glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> wrote:
Peter wrote:....
SUBROUTINE B(array)
REAL, DIMENSION(28,0:10001), INTENT(INOUT) :: array
Since Fortran doesn't have a conditional operator, it might be that
you could use a trick I saw once in a discussion about how NOT to
write Fortran code. Consider:
DO 1 I=1,100
DO 1 J=1,100
1 A(I,J)=(I/J)*(J/I)
Peter's INTENT(INOUT) shows that he isn't restricted to f77. In f95
I admit MERGE is not an operator, but it is a conditional function
useful for things like Glen's. Also, FORALL saves 2 lines, allowing
FORALL(I=1:100,J=1:100) A(I,J) = MERGE(1.0, 0.0, I==J)
-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@xxxxxxxxx phone (+64)(4)463 5341 fax (+64)(4)463 5045
.
- Follow-Ups:
- Re: Efficient way to pass different shaped arrays?
- From: glen herrmannsfeldt
- Re: Efficient way to pass different shaped arrays?
- References:
- Efficient way to pass different shaped arrays?
- From: Peter
- Re: Efficient way to pass different shaped arrays?
- From: glen herrmannsfeldt
- Efficient way to pass different shaped arrays?
- Prev by Date: Re: How to Find Memory Used (IVF 9.1, WinXP)
- Next by Date: Re: Efficient way to pass different shaped arrays?
- Previous by thread: Re: Efficient way to pass different shaped arrays?
- Next by thread: Re: Efficient way to pass different shaped arrays?
- Index(es):
Relevant Pages
|