next up previous contents
Next: Assumed Shape Arrays Up: Array Arguments Previous: Array Arguments   Contents

Explicit Shape Arrays

One possible definition of the subroutine is

subroutine commut(A,B,C)
  implicit none
  real, dimension(10,10), intent(in)  :: A, B
  real, dimension(10,10), intent(out) :: C
  C = matmul(A,B)-matmul(B,A)
end subroutine commut
The shape of the dummy array arguments A,B,C is explicitly declared: they are matrices. When calling the subroutine, the sizes and shapes of the actual arguments must of course conform to the sizes and shapes of dummy arguments; therefore, the routine can only compute the commutator of matrices. The explicit shape approach is very inflexible, and usually avoided.

Adrian Sandu 2001-08-26