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

NAG FL Interface Introduction
Example description
    Program x04dbfe

!     X04DBF Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, x04dbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nmax = 4, nout = 6
      Integer, Parameter               :: lda = nmax
      Character (7), Parameter         :: clabs(nmax) = (/'Un     ','Deux   ', &
                                          'Trois  ','Quatre '/)
      Character (7), Parameter         :: rlabs(nmax) = (/'Uno    ','Due    ', &
                                          'Tre    ','Quattro'/)
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: aa
      Integer                          :: i, ifail, indent, j, ncols
!     .. Local Arrays ..
      Complex (Kind=nag_wp)            :: a(lda,nmax)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: cmplx, real
!     .. Executable Statements ..
      Write (nout,*) 'X04DBF Example Program Results'

      Write (nout,*)
      Flush (nout)

!     Generate an array of data

      Do j = 1, nmax

        Do i = 1, lda
          aa = real(10*i+j,kind=nag_wp)
          a(i,j) = cmplx(aa,-aa,kind=nag_wp)
        End Do

      End Do

      ncols = 80
      indent = 0

!     Print (nmax-1) by nmax rectangular matrix with default format and
!     integer row and column labels, and bracketed complex elements

      ifail = 0
      Call x04dbf('General',' ',nmax-1,nmax,a,lda,'Bracketed',' ',             &
        'Example 1:','Integer',rlabs,'Integer',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print nmax by nmax upper triangular matrix with user-supplied format
!     and row and column labels, and complex elements with real part
!     above imaginary part

      ifail = 0
      Call x04dbf('Upper','Non-unit',nmax,nmax,a,lda,'Above','F8.2',           &
        'Example 2:','Character',rlabs,'Character',clabs,ncols,indent,ifail)

      Write (nout,*)
      Flush (nout)

!     Print (nmax-1) by nmax lower triangular matrix in MATLAB format
!     Row and column labelling and USEFRM are ignored

      ifail = 0
      Call x04dbf('Lower','Unit',nmax-1,nmax,a,lda,' ','MATLABF8.2','A',' ',   &
        rlabs,' ',clabs,ncols,indent,ifail)

    End Program x04dbfe