I'm tryng to learn to use a lapack subroutine but I got stuck. I hope this is the right forum... In this fortran program I'd like as a test to find the Shur form of the matrix ((0,1)(1,0)) using cgees, but the matrix "m" after the call in which the Shur form should be written, is made only of zeros (other subrotunes like dgemm work and I don't get errors so I don't think is a problem with the linking). Do you know where I do wrong?
.........................................................
program example
implicit none
integer :: d,sdim,info
real(kind=8),allocatable ::rwork(:)
logical, external :: sel
complex(kind=8), allocatable :: m(:,:),w(:),vs(:,:),work(:)
logical,allocatable ::bwork(:)
d=2
!
allocate(m(d,d))
allocate(w(d))
allocate(vs(d,d))
allocate(work(2*d))
allocate(rwork(d))
allocate(bwork(d))
!
m(1,1)=(0.d0,0.d0)
m(1,2)=(1.d0,0.d0)
m(2,1)=(1.d0,0.d0)
m(2,2)=(0.d0,0.d0)
!
print*,'m_before',m
!
print*,'w_before',w
call cgees('V','S',sel,d,m,d,sdim,w,vs,d,work,-1,rwork,bwork,info)
print*,'m',m
print*,'w',w
print*,'vs',vs
print*,info
end program example
logical function sel(x)
complex(kind=8) ::x
if (dimag(x)>1.d0) then
sel = .true.
else
sel = .false.
end if
return
end
.........................................