PROGRAM f07jnfe ! F07JNF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : nag_wp, zptsv ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: info, n ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: b(:), e(:) REAL (KIND=nag_wp), ALLOCATABLE :: d(:) ! .. Executable Statements .. WRITE (nout,*) 'F07JNF Example Program Results' WRITE (nout,*) ! Skip heading in data file READ (nin,*) READ (nin,*) n ALLOCATE (b(n),e(n-1),d(n)) ! Read the lower bidiagonal part of the tridiagonal matrix A and ! the right hand side b from data file READ (nin,*) d(1:n) READ (nin,*) e(1:n-1) READ (nin,*) b(1:n) ! Solve the equations Ax = b for x ! The NAG name equivalent of zptsv is f07jnf CALL zptsv(n,1,d,e,b,n,info) IF (info==0) THEN ! Print solution WRITE (nout,*) 'Solution' WRITE (nout,99999) b(1:n) ! Print details of factorization WRITE (nout,*) WRITE (nout,*) 'Diagonal elements of the diagonal matrix D' WRITE (nout,99998) d(1:n) WRITE (nout,*) WRITE (nout,*) 'Sub-diagonal elements of the Cholesky factor L' WRITE (nout,99999) e(1:n-1) ELSE WRITE (nout,99997) 'The leading minor of order ', info, & ' is not positive definite' END IF 99999 FORMAT (4(' (',F8.4,',',F8.4,')':)) 99998 FORMAT ((2X,F7.4,3(11X,F7.4))) 99997 FORMAT (1X,A,I3,A) END PROGRAM f07jnfe