! Figure 6.7
module matrix_ops
   public  ::  mult
   type, public :: matrix
      real :: element
   end type matrix
contains
   function mult(a, b) result(c)
      type(matrix), dimension(:,:), intent(in) :: a
      type(matrix), dimension(:), intent(in) :: b
      type(matrix), dimension(size(a, 1)) :: c
                     ! size is defined in Section 8.11.2
      integer :: j, n
      c = 0.0     ! A defined assignment from a real 
                  ! scalar to a rank-one matrix.
      n = size(a, 1)
      do j = 1, size(a, 2)
         c = c + a(1:n, j) * b(j) 
               ! Uses defined operations for addition of
               ! two rank-one matrices and multiplication
               ! of a rank-one matrix by a scalar matrix.
      end do
   end function mult
end module matrix_ops
