PROGRAM f01zbfe ! F01ZBF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : f01zbf, nag_wp, x04dbf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, lb, lda, lenb, n CHARACTER (1) :: diag, uplo ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:,:), b(:) CHARACTER (1) :: clabs(1), rlabs(1) ! .. Executable Statements .. WRITE (nout,*) 'F01ZBF Example Program Results' ! Skip heading in data file READ (nin,*) WRITE (nout,*) FLUSH (nout) READ (nin,*) n, uplo, diag lda = n lenb = (n*(n+1))/2 ALLOCATE (a(lda,n),b(lenb)) ! Read a triangular matrix of order n DO i = 1, n READ (nin,*) a(i,1:n) END DO ! ifail: behaviour on error exit ! =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft ifail = 0 ! Print the unpacked matrix CALL x04dbf(uplo,diag,n,n,a,lda,'B','F5.2','Unpacked Matrix A:','I', & rlabs,'I',clabs,80,0,ifail) WRITE (nout,*) FLUSH (nout) ! Convert to packed vector form ifail = 0 CALL f01zbf('Pack',uplo,diag,n,a,lda,b,ifail) lb = n*(n+1)/2 ! Print the packed vector ifail = 0 CALL x04dbf('G','X',lb,1,b,lb,'B','F5.2','Packed Vector B:','I',rlabs, & 'N',clabs,80,0,ifail) END PROGRAM f01zbfe