Program f06wqfe ! F06WQF Example Program Text ! Mark 24 Release. NAG Copyright 2012. ! .. 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