Re: dimension question



Michael Metcalf wrote:

(snip)

Since you have a f95 compiler, might I suggest that you learn Fortran 95 rather than Fortran 77. The solution to your problem is then to use an assumed-shape array:

(snip)

With assumed shape the subroutine can find out the actual size of
the array, and use that.

subroutine test(a)
real a(:, :)
integer i,j
do i=1,size(a,2)
print *, (a(j,i),j=1,size(a,1))
end subroutine test

If you require a square array compare size(a,1) and size(a,2)
and complain appropriately. For assumed shape it is still faster
to have the leftmost subscript vary faster, as above. In this
case the a in the subroutine is in non-contiguous storage, which
may be slower.

-- glen

.



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)