! Example to illustrate GEMM operation on submatrices.
!   A is 6 X 10, B is 5 X 6, C is 6 X 8
!   User wants to set C(2:5,5:6) = A(2:5,5:7) * B(2:4,2:3)
!
program xsgemm
implicit none
real :: A(6,10), B(5,6), C(6,8)
integer :: i,j,k

! Initialize A and B
!
do j=1,10
   do i=1,6
      A(i,j)=(i-1)*10+j-1
   end do
end do

do j=1,6
   do i=1,5
      B(i,j) = (i-1)*6+j-1
   end do
end do

call sgemm('N','N',4,2,3,1.0,A(2,5),6,B(2,2),5,0.0,C(2,5),6)

do i=1,4
   write(*,'(1x,2F10.4)')(C(1+i,j+4),j=1,2)
end do
end program xsgemm
