Program x04dffe
! X04DFF Example Program Text
! Mark 26.1 Release. NAG Copyright 2016.
! .. Use Statements ..
Use nag_library, Only: f01zdf, nag_wp, x04dff
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Integer, Parameter :: n = 5, nout = 6
Character (7), Parameter :: clabs(n) = (/'Un ','Deux ', &
'Trois ','Quatre ','Cinq '/)
Character (7), Parameter :: rlabs(n) = (/'Uno ','Due ', &
'Tre ','Quattro','Cinque '/)
! .. Local Scalars ..
Real (Kind=nag_wp) :: aa
Integer :: i, ifail, indent, j, kl, ku, ku_a, &
lda, ldab, m, ncols
Character (19) :: form
Character (1) :: job
! .. Local Arrays ..
Complex (Kind=nag_wp), Allocatable :: a(:,:), ab(:,:)
! .. Intrinsic Procedures ..
Intrinsic :: cmplx, max, min, real
! .. Executable Statements ..
Write (nout,*) 'X04DFF Example Program Results'
Write (nout,*)
Flush (nout)
! Generate a square array of data.
m = n
kl = 1
ku_a = 2
lda = m
Allocate (a(lda,n))
Do j = 1, n
Do i = max(1,j-ku_a), 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 a to packed storage, ignoring the second superdiagonal.
ldab = kl + ku_a + 1
Allocate (ab(ldab,n))
ku = 1
job = 'P'
ifail = 0
Call f01zdf(job,m,n,kl,ku,a,lda,ab,ldab,ifail)
ncols = 80
indent = 0
! Print m by n band matrix with kl subdiagonals, 1 superdiagonal,
! default format, bracketed complex numbers, and integer row and
! column labels
form = ' '
ifail = 0
Call x04dff(m,n,kl,1,ab,ldab,'Bracketed',form,'Example 1:','Integer', &
rlabs,'Integer',clabs,ncols,indent,ifail)
Write (nout,*)
Flush (nout)
! Convert the whole matrix a to packed storage.
ku = ku_a
job = 'P'
ifail = 0
Call f01zdf(job,m,n,kl,ku,a,lda,ab,ldab,ifail)
! Print (m-1) by (n-1) band matrix with kl subdiagonals,
! ku superdiagonals, user-supplied format and row and column labels.
form = 'SS,F7.1,SP,F6.1,''i'''
ifail = 0
Call x04dff(m-1,n-1,kl,ku,ab,ldab,'Direct',form,'Example 2:', &
'Character',rlabs,'Character',clabs,ncols,indent,ifail)
Write (nout,*)
Flush (nout)
! Print (m-1) by (n-1) band matrix with kl subdiagonals,
! ku superdiagonals, in MATLAB format.
! Row and column labelling and USEFRM are ignored.
form = 'MATLABF7.1'
ifail = 0
Call x04dff(m-1,n-1,kl,ku,ab,ldab,' ',form,'A',' ',rlabs,' ',clabs, &
ncols,indent,ifail)
End Program x04dffe