My understanding is that I can leave out explicit enumerstion of imbedded matrices
in the argument list. How does the called routine know the dimensions of the matrix?
Of course with Fortran 77, that feature was not available, but is with Fortran '95
Example with a 3x3 imbedded matrix:
REAL*8 A(20,20),SUM
CALL SUM_IT( A(3:5,5:7) , SUM)
END
SUBROUTINE SUM_IT(A,SUM)
REAL*8 A(:,:),SUM
SUM=0.0
DO IRA=1,NRA
DO ICA=1,NCA
SUM=SUM+A(IRA,ICA)
END
--------------------------------------------------------------------------------------------------------------
Now, how would the subroutine be able to get the quantities NRA and NCA?
I think there is a function I can call.
Is that the usual way to get those quantities?
I realize there is a SUM function, but this is just a simple example.
链接已复制
The language requires that you provide an "explicit interfsce" for SUM_IT that is visible to the caller because SUM_IT has an assumed-shape argument. The code you show does not do that and it is not legal. Typically you would put SUM_IT in a module and USE the module, or you can make it a CONTAINed routine.
The intrinsics you want are LBOUND and UBOUND.
