Program f06wnfe
! F06WNF Example Program Text
! Mark 30.0 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: nag_wp, zlanhf, ztrttf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nin = 5, nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: r_fro, r_inf, r_max, r_one
Integer :: i, info, lda, n
Character (1) :: transr, uplo
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:), ar(:)
Real (Kind=nag_wp), Allocatable :: work(:)
! .. Executable Statements ..
Write (nout,*) 'F06WNF Example Program Results'
! Skip heading in data file
Read (nin,*)
Read (nin,*) n, uplo, transr
lda = n
Allocate (a(lda,n),ar((n*(n+1))/2),work(n))
! Read upper or lower triangle of matrix A from data file
If (uplo=='L' .Or. uplo=='l') Then
Do i = 1, n
Read (nin,*) a(i,1:i)
End Do
Else
Do i = 1, n
Read (nin,*) a(i,i:n)
End Do
End If
! Convert A to rectangular full packed storage in ar
! The NAG name equivalent of ztrttf is f01vff
Call ztrttf(transr,uplo,n,a,lda,ar,info)
Write (nout,*)
Write (nout,99999) &
'Norms of Hermitian matrix stored in RFP format in ar:'
Write (nout,*)
! The NAG name equivalent of zlanhf is f06wnf
r_one = zlanhf('1-norm',transr,uplo,n,ar,work)
Write (nout,99998) 'One norm = ', r_one
r_inf = zlanhf('Infinity',transr,uplo,n,ar,work)
Write (nout,99998) 'Infinity norm = ', r_inf
r_fro = zlanhf('Frobenius',transr,uplo,n,ar,work)
Write (nout,99998) 'Frobenius norm = ', r_fro
r_max = zlanhf('Max norm',transr,uplo,n,ar,work)
Write (nout,99998) 'Maximum norm = ', r_max
99999 Format (1X,A)
99998 Format (1X,A,F9.4)
End Program f06wnfe