* F08QVF Example Program Text * Mark 21 Release. NAG Copyright 2004. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER MMAX, NMAX PARAMETER (MMAX=8,NMAX=8) INTEGER LDA, LDB, LDC PARAMETER (LDA=MMAX,LDB=NMAX,LDC=MMAX) * .. Local Scalars .. DOUBLE PRECISION SCALE INTEGER I, IFAIL, INFO, J, M, N * .. Local Arrays .. COMPLEX *16 A(LDA,MMAX), B(LDB,NMAX), C(LDC,NMAX) CHARACTER CLABS(1), RLABS(1) * .. External Subroutines .. EXTERNAL X04DBF, ZTRSYL * .. Executable Statements .. WRITE (NOUT,*) 'F08QVF Example Program Results' WRITE (NOUT,*) * Skip heading in data file READ (NIN,*) READ (NIN,*) M, N IF (M.LE.MMAX .AND. N.LE.NMAX) THEN * * Read A, B and C from data file * READ (NIN,*) ((A(I,J),J=1,M),I=1,M) READ (NIN,*) ((B(I,J),J=1,N),I=1,N) READ (NIN,*) ((C(I,J),J=1,N),I=1,M) * * Solve the Sylvester equation A*X + X*B = C for X * CALL ZTRSYL('No transpose','No transpose',1,M,N,A,LDA,B,LDB,C, + LDC,SCALE,INFO) IF (INFO.GE.1) THEN WRITE (NOUT,99999) WRITE (NOUT,*) END IF * * Print the solution matrix X * IFAIL = 0 CALL X04DBF('General',' ',M,N,C,LDC,'Bracketed','F7.4', + 'Solution matrix X','Integer',RLABS,'Integer', + CLABS,80,0,IFAIL) * WRITE (NOUT,*) WRITE (NOUT,99998) 'SCALE = ', SCALE ELSE WRITE (NOUT,*) 'MMAX and/or NMAX too small' END IF STOP * 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