Dimension passing of imbedded matrices

Dimension passing of imbedded matrices

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)



REAL*8 A(:,:),SUM







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.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Retired 12/31/2016

ive run across that double posting...not sure what's causing it...

anyhow try the Shape function. Size only returns number of elements,

see help file for details on Shape.

I understand the use of CONTAINS or USE, as Steve pointed out.

But how do the LAPACK math routines get around having to do that?

Is that a special trick they use?

Is that their special USE statement?

The LAPACK F77-interface routines require you to pass the individual array bounds.  The "F95 interface" routines require a USE that provides the explicit interface.

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today