@extract -b incpath.inc
@extract -b @(incd)/type.inc type=@(@type)
@ROUT stevd
PROGRAM LA_@(pre)STEVD_ET_EXAMPLE
@extract -b @(incd)/header.inc -case0
!  .. Use Statements
   USE LA_PRECISION, ONLY: WP => @(upr)P
   USE F90_LAPACK, ONLY: LA_STEVD
!  .. Implicit Statement ..
   IMPLICIT NONE
!  .. Parameters ..
 @type sreal dreal
      CHARACTER(LEN=*), PARAMETER :: FMT = '(8(1X,F10.3))'
 @type scplx dcplx sherm dherm
      CHARACTER(LEN=*), PARAMETER :: FMT = '(4(1X,1H(,F7.3,1H,,F7.3,1H):))'
 @type !
   INTEGER, PARAMETER :: NIN=5, NOUT=6
!  .. Local Scalars ..
   INTEGER :: I, INFO, N
!  .. Local Arrays ..
   REAL(WP), ALLOCATABLE :: D(:), DD(:), E(:), EE(:), Z(:,:), DUMMY(:)
!  .. Executable Statements ..
   WRITE (NOUT,*) '@(pre)STEVD ET_Example Program Results.'
   READ ( NIN, * )   ! Skip heading in data file
   READ ( NIN, * ) N
   PRINT *, 'N = ', N
   ALLOCATE ( D(N), DD(N), E(N-1), EE(N-1), Z(N,N) )
!
   READ (NIN, *) DD, EE
   WRITE(NOUT,*) 'The matrix A:'
   WRITE (NOUT,*) 'D  '; WRITE (NOUT,FMT) DD
   WRITE (NOUT,*) 'EE '; WRITE (NOUT,FMT) EE
!
   WRITE ( NOUT, * )'---------------------------------------------------------'
   WRITE ( NOUT, * )
   WRITE ( NOUT, * )'Details of LA_@(pre)STEVX LAPACK Subroutine Results.'
   WRITE ( NOUT, * )
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E, Z, INFO )'
   D = DD; E = EE
   CALL LA_STEVD( D, E, Z, INFO )
   WRITE(NOUT,*) 'INFO = ', INFO, ' EIGENVALUES:'
   WRITE(NOUT,FMT) D
   WRITE(NOUT,*) 'EIGENVECTORS:'
   DO I = 1, N; WRITE(NOUT,*) 'I = ', I; WRITE (NOUT,FMT) Z(:,I); END DO
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E, Z )'
   D = DD; E = EE
   CALL LA_STEVD( D, E, Z )
   WRITE(NOUT,*) ' EIGENVALUES:'
   WRITE(NOUT,FMT) D
   WRITE(NOUT,*) 'EIGENVECTORS:'
   DO I = 1, N; WRITE(NOUT,*) 'I = ', I; WRITE (NOUT,FMT) Z(:,I); END DO
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E )'
   D = DD; E = EE
   CALL LA_STEVD( D, E )
   WRITE(NOUT,*) ' EIGENVALUES:'
   WRITE(NOUT,FMT) D
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( DUMMY, E, INFO=INFO )'
   D = DD; E = EE
   CALL LA_STEVD( DUMMY, E, INFO=INFO )
   WRITE(NOUT,*) 'INFO = ', INFO
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E(1:N), INFO=INFO )'
   D = DD; E = EE
   CALL LA_STEVD( D, E(1:N), INFO=INFO )
   WRITE(NOUT,*) 'INFO = ', INFO
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E, Z=Z(1:N-1,:), INFO=INFO )'
   D = DD; E = EE
   CALL LA_STEVD( D, E, Z=Z(1:N-1,:), INFO=INFO )
   WRITE(NOUT,*) 'INFO = ', INFO
!
   WRITE(NOUT,*)
   WRITE(NOUT,*) 'CALL LA_STEVD( D, E, Z=Z(:,1:N-1) )'
   D = DD; E = EE
   CALL LA_STEVD( D, E, Z=Z(:,1:N-1) )
!
END PROGRAM LA_@(pre)STEVD_ET_EXAMPLE
