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

NAG FL Interface Introduction
Example description
    Program f01bufe

!     F01BUF Example Program Text

!     Mark 30.1 Release. NAG Copyright 2024.

!     .. Use Statements ..
      Use nag_library, Only: f01buf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, j, k, lda, m, m1, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), w(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: max
!     .. Executable Statements ..
      Write (nout,*) 'F01BUF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n, m1
      lda = m1
      Allocate (a(lda,n),w(m1))
      Read (nin,*)((a(j,i),j=max(1,m1+1-i),m1),i=1,n)
      m = m1 - 1
      k = ((n+m)/(2*m))*m

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call f01buf(n,m1,k,a,lda,w,ifail)

      Write (nout,*)
      Write (nout,*) 'Computed upper triangular matrix'
      Write (nout,*)
      Do i = 1, n
        Write (nout,99999)(a(j,i),j=max(1,m1+1-i),m1)
      End Do

99999 Format (1X,8F9.4)
    End Program f01bufe