	PROGRAM xtqli
!	driver for routine tqli
	USE nrtype
	USE nr
	IMPLICIT NONE
	INTEGER(I4B), PARAMETER :: NP=10
	REAL(DP), PARAMETER :: TINY=1.0e-6_dp
	INTEGER(I4B) :: i,j
	REAL(DP), DIMENSION(NP) :: d,e,f
	REAL(DP), DIMENSION(NP,NP) :: a,c = reshape( (/ &
		5.0_dp,4.3_dp,3.0_dp,2.0_dp,1.0_dp,&
		0.0_dp,-1.0_dp,-2.0_dp,-3.0_dp,-4.0_dp,&
		4.3_dp,5.1_dp,4.0_dp,3.0_dp,2.0_dp,&
		1.0_dp,0.0_dp,-1.0_dp,-2.0_dp,-3.0_dp,&
		3.0_dp,4.0_dp,5.0_dp,4.0_dp,3.0_dp,&
		2.0_dp,1.0_dp,0.0_dp,-1.0_dp,-2.0_dp,&
		2.0_dp,3.0_dp,4.0_dp,5.0_dp,4.0_dp,&
		3.0_dp,2.0_dp,1.0_dp,0.0_dp,-1.0_dp,&
		1.0_dp,2.0_dp,3.0_dp,4.0_dp,5.0_dp,&
		4.0_dp,3.0_dp,2.0_dp,1.0_dp,0.0_dp,&
		0.0_dp,1.0_dp,2.0_dp,3.0_dp,4.0_dp,&
		5.0_dp,4.0_dp,3.0_dp,2.0_dp,1.0_dp,&
		-1.0_dp,0.0_dp,1.0_dp,2.0_dp,3.0_dp,&
		4.0_dp,5.0_dp,4.0_dp,3.0_dp,2.0_dp,&
		-2.0_dp,-1.0_dp,0.0_dp,1.0_dp,2.0_dp,&
		3.0_dp,4.0_dp,5.0_dp,4.0_dp,3.0_dp,&
		-3.0_dp,-2.0_dp,-1.0_dp,0.0_dp,1.0_dp,&
		2.0_dp,3.0_dp,4.0_dp,5.0_dp,4.0_dp,&
		-4.0_dp,-3.0_dp,-2.0_dp,-1.0_dp,0.0_dp,&
		1.0_dp,2.0_dp,3.0_dp,4.0_dp,5.0_dp /),&
		(/ NP,NP /) )
	a(:,:)=c(:,:)
	call tred2(a,d,e)
	call tqli(d,e,a)
        print*,d; stop
	write(*,'(/1x,a)') 'Eigenvectors for a real symmetric matrix'
	do i=1,NP
		f=matmul(c(:,:),a(:,i))
		write(*,'(/1x,a,i3,a,f10.6)') 'Eigenvalue',i,' =',d(i)
		write(*,'(/1x,t7,a,t17,a,t31,a)') 'Vector','Mtrx*Vect.','Ratio'
		do j=1,NP
			if (abs(a(j,i)) < TINY) then
				write(*,'(1x,2f12.6,a12)') a(j,i),f(j),'div. by 0'
			else
				write(*,'(1x,2f12.6,e14.6)') a(j,i),f(j),&
					f(j)/a(j,i)
			end if
		end do
		write(*,'(/1x,a)') 'press ENTER to continue...'
		read(*,*)
	end do
	END PROGRAM xtqli
