Re: Efficient way to pass different shaped arrays?



Michael Metcalf wrote:
Well, you could use an assumed-shape array. This would require an explicit
interface 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.

.



Relevant Pages

  • Re: VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.fortran)
  • VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.fortran)
  • VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.basic.visual.misc)
  • Re: VB .Net and Intel Visual Fortran 9
    ... having is that the VB program cannot load the DLL. ... subroutine) to accept an array from VB - in my case a 2D array. ... Declare Sub mmult Lib "test.dll" (ByRef i As Double, ByRef j As Double, ...
    (comp.lang.basic.visual.misc)
  • Re: memory leak help!
    ... a loop from the main program. ... REPLACE THE NEW COMPLEX INTO ORIGINAL ARRAY x ... END OF SUBROUTINE SCEUA ... IMPLICIT NONE ...
    (comp.lang.fortran)