subroutine hdiag_L(h,v,n,m)
use mod_script
implicit none
real(8) :: h(m,m),v(m,m)
integer m,n,lwork,info,i
real(8),allocatable :: E(:),WORK(:)
logical :: yw=.false.

allocate(E(n))

LWORK=max(1,3*N-1)
if(yw)print*,'lwork',lwork
allocate(work(lwork))
call DSYEV('V','L',N,H,M,E,WORK,-1, INFO )
LWORK=WORK(1)
if(yw)print*,'lwork',lwork
deallocate(work)
allocate(work(lwork))

H=-H
call DSYEV('V','L',N,H,M,E,WORK,lwork,INFO )
E=-E
H=-H

if(info/=0) then
   print*,'erreur dans DSYEV, info=',info
   stop
endif

if(yw) then
   print*,' '
   print*,'valeurs propres'
   print'(10f8.4)',E
   print*,' '
   print*,'vecteurs propres'
   call mscript(H)
endif
v=h
h=0.d0
do i=1,n
   h(i,i)=e(i)
enddo
deallocate(E,work)
end
