Program x04defe
! X04DEF Example Program Text
! Mark 30.0 Release. NAG Copyright 2024.
! .. Use Statements ..
Use nag_library, Only: f01zdf, nag_wp, x04def
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: nout = 6
! .. Local Scalars ..
Real (Kind=nag_wp) :: aa
Integer :: i, ifail, j, kl, ku, lda, ldab, m, n
Character (1) :: job
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:), ab(:,:)
! .. Intrinsic Procedures ..
Intrinsic :: cmplx, max, min, real
! .. Executable Statements ..
Write (nout,*) 'X04DEF 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)
aa = real(10*i+j,kind=nag_wp)
a(i,j) = cmplx(aa,-aa,kind=nag_wp)
End Do
End Do
! Convert to packed storage.
ldab = kl + ku + 1
Allocate (ab(ldab,n))
job = 'P'
ifail = 0
Call f01zdf(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 x04def(m,n,kl,ku,ab,ldab,'Band Matrix:',ifail)
End Program x04defe