NAG Library Manual, Mark 30.2
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program f06wqfe

!     F06WQF Example Program Text

!     Mark 30.2 Release. NAG Copyright 2024.

!     .. 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(:,:), cr(:)
!     .. 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),cr((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 cr

!     The NAG name equivalent of ztrttf is f01vff
      Call ztrttf(transr,uplo,n,c,lda,cr,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,cr)

!     Convert cr back from rectangular full packed to standard format in C

!     The NAG name equivalent of ztfttr is f01vhf
      Call ztfttr(transr,uplo,n,cr,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