Program x04cefe
! X04CEF Example Program Text
! Mark 27.1 Release. NAG Copyright 2020.
! .. Use Statements ..
Use nag_library, Only: f01zcf, nag_wp, x04cef
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nout = 6
! .. Local Scalars ..
Integer :: i, ifail, j, kl, ku, lda, ldab, m, n
Character (1) :: job
! .. Local Arrays ..
Real (Kind=nag_wp), Allocatable :: a(:,:), ab(:,:)
! .. Intrinsic Procedures ..
Intrinsic :: max, min, real
! .. Executable Statements ..
Write (nout,*) 'X04CEF Example Program Results'
Write (nout,*)
Flush (nout)
! Generate a square array of data.
m = 5
n = m
kl = 1
ku = 1
lda = m
Allocate (a(lda,n))
Do j = 1, n
Do i = max(1,j-ku), min(m,j+kl)
a(i,j) = real(10*i+j,kind=nag_wp)
End Do
End Do
! Convert to packed storage.
ldab = kl + ku + 1
Allocate (ab(ldab,n))
job = 'P'
ifail = 0
Call f01zcf(job,m,n,kl,ku,a,lda,ab,ldab,ifail)
! Print m by n band matrix with kl subdiagonals and ku superdiagonals.
ifail = 0
Call x04cef(m,n,kl,ku,ab,ldab,'Band Matrix:',ifail)
End Program x04cefe