Page 1 of 1

Using zheev subroutine

PostPosted: Mon Aug 20, 2012 7:31 pm
by jivifair
Hi everyone,

I'm using the subroutine zheev to diagonalize a complex hamiltonian matrix.
Here is my problem, if I grow the dimension of my matrix (say dim= dim+100)
I get an error message like this:

On entry to ZHEEV parameter number 8 had an illegal value

If I only use the non-aumented job ( equal to dim ), the task is accomplished
in a good way.
I don't know how to fix this bug, I think it is because one has to initialize the subroutine

lwork= -1_i4
Call ZHEEV( 'V', 'L', dimen, matrix, dimen, wr, work, lwork, rwork, info ),

but I don't know how to improve the subroutine to do huge dimensional hamiltonian matrix


Adrian O.

Re: Using zheev subroutine

PostPosted: Tue Aug 21, 2012 1:39 am
by Julien Langou
You need to perform a workspace query to know the size of WORK needed by ZHEEV to work properly.
You first need to set LWORK to -1, and call ZHEEV. (WORK needs to be of size at least 1.) This activates a workspace query
and the value for the size of the workspace is returned in WORK(1). Then you set LWORK = WORK(1). Then you DEALLOCATE WORK.
Then you reALLOCATE work of size LWORK. Then you call again the routine ZHEEV and this times the computation should occur. To repeat, at the second call,
WORK should be of the correct size (so you need to allocate WORK) and LWORK needs to be an INTEGER of this dimension as well.
Look for "workspace query" in this forum for more hints.