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

NAG FL Interface Introduction
Example description
    Program f01ckfe

!     F01CKF Example Program Text

!     Mark 28.5 Release. NAG Copyright 2022.

!     .. Use Statements ..
      Use nag_library, Only: f01ckf, nag_wp, x04cbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: indent = 0, iz = 1, ncols = 80,      &
                                          nin = 5, nout = 6, opt = 1
      Character (1), Parameter         :: diag = 'N', matrix = 'G',            &
                                          nolabel = 'N'
      Character (4), Parameter         :: form = 'F7.1'
!     .. Local Scalars ..
      Integer                          :: i, ifail, j, m, n, p
      Character (8)                    :: title
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), b(:,:), c(:,:)
      Real (Kind=nag_wp)               :: z(iz)
      Character (1)                    :: dummy(1)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: real
!     .. Executable Statements ..
      Write (nout,*) 'F01CKF Example Program Results'
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n, p, m

      Allocate (a(n,p),b(n,m),c(m,p))

!     Set up example B and C matrices
      Do i = 1, m
        Do j = 1, n
          b(j,i) = real(i+j-2,kind=nag_wp)
        End Do
        Do j = 1, p
          c(i,j) = real(i+j-2,kind=nag_wp)
        End Do
      End Do

!     ifail: behaviour on error exit
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
      ifail = 0
      Call f01ckf(a,b,c,n,p,m,z,iz,opt,ifail)

!     Print the result matrix A
      title = 'Matrix A'
      Write (nout,*)
      Flush (nout)
      ifail = 0
      Call x04cbf(matrix,diag,n,p,a,n,form,title,nolabel,dummy,nolabel,dummy,  &
        ncols,indent,ifail)

    End Program f01ckfe