* F08UEF Example Program Text. * Mark 19 Release. NAG Copyright 1999. * .. Parameters .. INTEGER NIN, NOUT PARAMETER (NIN=5,NOUT=6) INTEGER NMAX, KMAX, LDAB, LDBB, LDX PARAMETER (NMAX=8,KMAX=8,LDAB=KMAX-1,LDBB=KMAX-1,LDX=NMAX) * .. Local Scalars .. INTEGER I, INFO, J, KA, KB, N CHARACTER UPLO * .. Local Arrays .. DOUBLE PRECISION AB(LDAB,NMAX), BB(LDBB,NMAX), D(NMAX), E(NMAX-1), + WORK(2*NMAX), X(LDX,NMAX) * .. External Subroutines .. EXTERNAL DPBSTF, DSBGST, DSBTRD, DSTERF * .. Intrinsic Functions .. INTRINSIC MAX, MIN * .. Executable Statements .. WRITE (NOUT,*) 'F08UEF Example Program Results' * Skip heading in data file READ (NIN,*) READ (NIN,*) N, KA, KB IF (N.LE.NMAX .AND. KA.LE.KMAX .AND. KB.LE.KA) THEN * * Read A and B from data file * READ (NIN,*) UPLO IF (UPLO.EQ.'U') THEN DO 20 I = 1, N READ (NIN,*) (AB(KA+1+I-J,J),J=I,MIN(N,I+KA)) 20 CONTINUE DO 40 I = 1, N READ (NIN,*) (BB(KB+1+I-J,J),J=I,MIN(N,I+KB)) 40 CONTINUE ELSE IF (UPLO.EQ.'L') THEN DO 60 I = 1, N READ (NIN,*) (AB(1+I-J,J),J=MAX(1,I-KA),I) 60 CONTINUE DO 80 I = 1, N READ (NIN,*) (BB(1+I-J,J),J=MAX(1,I-KB),I) 80 CONTINUE END IF * * Compute the split Cholesky factorization of B * CALL DPBSTF(UPLO,N,KB,BB,LDBB,INFO) * WRITE (NOUT,*) IF (INFO.GT.0) THEN WRITE (NOUT,*) 'B is not positive-definite.' ELSE * * Reduce the problem to standard form C*y = lambda*y, storing * the result in A * CALL DSBGST('N',UPLO,N,KA,KB,AB,LDAB,BB,LDBB,X,LDX,WORK, + INFO) * * Reduce C to tridiagonal form T = (Q**T)*C*Q * CALL DSBTRD('N',UPLO,N,KA,AB,LDAB,D,E,X,LDX,WORK,INFO) * * Calclate the eigenvalues of T (same as C) * CALL DSTERF(N,D,E,INFO) * IF (INFO.GT.0) THEN WRITE (NOUT,*) 'Failure to converge.' ELSE * * Print eigenvalues * WRITE (NOUT,*) 'Eigenvalues' WRITE (NOUT,99999) (D(I),I=1,N) END IF END IF END IF STOP * 99999 FORMAT (3X,(8F8.4)) END