
C THIS ROUTINE COPIES AN NROWFRM BY NCOLFRM BLOCK MATRIX (MATFRM)
C INTO AN NROWTAR BY NCOLTAR TARGET MATRIX (MATTAR) SUCH THAT 
C THE (1,1) ELEMENT IN MATFRM BECOMES THE IROWTAR,ICOLTAR ELEMENT 
C IN MATTAR.

      SUBROUTINE BLKCPY(MATFRM,NROWFRM,NCOLFRM,MATTAR,NROWTAR,NCOLTAR,
     &                  IROWTAR,ICOLTAR)
      IMPLICIT INTEGER (A-Z)
      DOUBLE PRECISION MATTAR(NROWTAR*NCOLTAR),MATFRM(NROWFRM,NCOLFRM)
      COMMON /MACHSP/ IINTLN,IFLTLN,IINTFP,IALONE,IBITWD

      if (ncolfrm.lt.0) then
         print *, '@BLKCPY: Assertion failed.'
         print *, '         ncolfrm = ',ncolfrm
         call errex
      end if

      ISTART = IROWTAR + (ICOLTAR-1)*NROWTAR
      DO ICOL = 1, NCOLFRM
         CALL XCOPY(NROWFRM,MATFRM(1,ICOL),1,MATTAR(ISTART),1)
         ISTART = ISTART + NROWTAR
      END DO
      RETURN
      END
