PROGRAM f08qvfe ! F08QVF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : nag_wp, x04dbf, ztrsyl ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: scal INTEGER :: i, ifail, info, lda, ldb, ldc, m, n ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:,:), b(:,:), c(:,:) CHARACTER (1) :: clabs(1), rlabs(1) ! .. Executable Statements .. WRITE (nout,*) 'F08QVF Example Program Results' WRITE (nout,*) FLUSH (nout) ! Skip heading in data file READ (nin,*) READ (nin,*) m, n lda = m ldb = n ldc = m ALLOCATE (a(lda,m),b(ldb,n),c(ldc,n)) ! Read A, B and C from data file READ (nin,*) (a(i,1:m),i=1,m) READ (nin,*) (b(i,1:n),i=1,n) READ (nin,*) (c(i,1:n),i=1,m) ! Solve the Sylvester equation A*X + X*B = C for X ! The NAG name equivalent of ztrsyl is f08qvf CALL ztrsyl('No transpose','No transpose',1,m,n,a,lda,b,ldb,c,ldc,scal, & info) IF (info>=1) THEN WRITE (nout,99999) WRITE (nout,*) FLUSH (nout) END IF ! Print the solution matrix X ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 CALL x04dbf('General',' ',m,n,c,ldc,'Bracketed','F7.3', & 'Solution matrix X','Integer',rlabs,'Integer',clabs,80,0,ifail) WRITE (nout,*) WRITE (nout,99998) 'SCAL = ', scal 99999 FORMAT (/' A and B have common or very close eigenvalues.'/' Pe', & 'rturbed values were used to solve the equations') 99998 FORMAT (1X,A,1P,E10.2) END PROGRAM f08qvfe