Re: Efficient way to pass different shaped arrays?
- From: "Peter" <sherwood@xxxxxxxxxxxxxx>
- Date: 28 Jun 2006 15:31:51 -0700
Michael Metcalf wrote:
Well, you could use an assumed-shape array. This would require an explicitinterface and also the ranks to be identical. Thus, it might look like:
REAL, DIMENSION(3,1) :: array ! dummy second dimension
CALL B(array)
SUBROUTINE B(array) ! in a module or as an internal procedure
REAL, DIMENSION(:, 0:), INTENT(INOUT) :: array
You can use the lbound and ubound intrinsics to find out the actual bounds
at run time.
Efficiency is paramount here, because B is called millions of times. So
I am reluctant to use any method which adds execution time. I guess
that for an assumed-shape array, the address computations are more
time-consuming, since the dimensions are not compile-time constants,
but run-time variables.
The bounds of the array are being passed as separate arguments now.
.
- Follow-Ups:
- Re: Efficient way to pass different shaped arrays?
- From: glen herrmannsfeldt
- Re: Efficient way to pass different shaped arrays?
- From: Richard Maine
- 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: Michael Metcalf
- Efficient way to pass different shaped arrays?
- Prev by Date: Re: Efficient way to pass different shaped arrays?
- 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
|