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

NAG FL Interface Introduction
Example description
    Program f11mlfe

!     F11MLF Example Program Text

!     Mark 27.3 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: f11mlf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: anorm
      Integer                          :: i, ifail, n, nnz
      Character (1)                    :: norm
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:)
      Integer, Allocatable             :: icolzp(:), irowix(:)
!     .. Executable Statements ..
      Write (nout,*) 'F11MLF Example Program Results'
!     Skip heading in data file
      Read (nin,*)

!     Read order of matrix and number of right hand sides

      Read (nin,*) n

      Allocate (icolzp(n+1))

!     Read the matrix A

      Read (nin,*) icolzp(1:n+1)
      nnz = icolzp(n+1) - 1

      Allocate (a(nnz),irowix(nnz))

      Do i = 1, nnz
        Read (nin,*) a(i), irowix(i)
      End Do

!     Calculate 1-norm

      norm = '1'

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call f11mlf(norm,anorm,n,icolzp,irowix,a,ifail)

!     Output norm

      Write (nout,*)
      Write (nout,*) 'One-norm'
      Write (nout,'(F7.3)') anorm

!     Calculate M-norm

      norm = 'M'

      ifail = 0
      Call f11mlf(norm,anorm,n,icolzp,irowix,a,ifail)

!     Output norm

      Write (nout,*)
      Write (nout,*) 'Max'
      Write (nout,'(F7.3)') anorm

!     Calculate I-norm

      norm = 'I'

      ifail = 0
      Call f11mlf(norm,anorm,n,icolzp,irowix,a,ifail)

!     Output norm

      Write (nout,*)
      Write (nout,*) 'Infinity-norm'
      Write (nout,'(F7.3)') anorm

    End Program f11mlfe