PROGRAM f06wqfe ! F06WQF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : nag_wp, x04daf, zhfrk, ztfttr, ztrttf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. REAL (KIND=nag_wp) :: alpha, beta INTEGER :: i, ifail, info, k, lda, n CHARACTER (1) :: trans, transr, uplo ! .. Local Arrays .. COMPLEX (KIND=nag_wp), ALLOCATABLE :: a(:,:), c(:,:), cf(:) ! .. Executable Statements .. WRITE (nout,*) 'F06WQF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, k, uplo, transr, alpha, beta, trans lda = n ALLOCATE (c(lda,n),cf((n*(n+1))/2),a(lda,k)) ! Read upper or lower triangle of matrix C from data file IF (uplo=='L' .OR. uplo=='l') THEN DO i = 1, n READ (nin,*) c(i,1:i) END DO ELSE DO i = 1, n READ (nin,*) c(i,i:n) END DO END IF ! Read matrix A from data file READ (nin,*) (a(i,1:k),i=1,n) ! Convert C to rectangular full packed storage in CF ! The NAG name equivalent of ztrttf is f01vef CALL ztrttf(transr,uplo,n,c,lda,cf,info) WRITE (nout,*) FLUSH (nout) ! Perform the rank-k update ! The NAG name equivalent of zhfrk is f06wqf CALL zhfrk(transr,uplo,trans,n,k,alpha,a,lda,beta,cf) ! Convert CF back from rectangular full packed to standard format in C ! The NAG name equivalent of ztfttr is f01vhf CALL ztfttr(transr,uplo,n,cf,c,lda,info) ! Print out the result, stored in the lower triangle of matrix C ifail = 0 CALL x04daf('Lower','N',n,n,c,lda,'The Solution',ifail) END PROGRAM f06wqfe