PROGRAM f06wafe ! F06WAF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : dlansf, dtrttf, nag_wp ! .. 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 .. REAL (KIND=nag_wp), ALLOCATABLE :: a(:,:), af(:), work(:) ! .. Executable Statements .. WRITE (nout,*) 'F06WAF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) n, uplo, transr lda = n ALLOCATE (a(lda,n),af((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 AF ! The NAG name equivalent of dtrttf is f01vef CALL dtrttf(transr,uplo,n,a,lda,af,info) WRITE (nout,*) WRITE (nout,99999) 'Norms of symmetric matrix stored in AF:' WRITE (nout,*) ! The NAG name equivalent of dlansf is f06waf r_one = dlansf('1-norm',transr,uplo,n,af,work) WRITE (nout,99998) 'One norm = ', r_one r_inf = dlansf('Infinity',transr,uplo,n,af,work) WRITE (nout,99998) 'Infinity norm = ', r_inf r_fro = dlansf('Frobenius',transr,uplo,n,af,work) WRITE (nout,99998) 'Frobenius norm = ', r_fro r_max = dlansf('Max norm',transr,uplo,n,af,work) WRITE (nout,99998) 'Maximum norm = ', r_max 99999 FORMAT (1X,A) 99998 FORMAT (1X,A,F9.4) END PROGRAM f06wafe