Page **1** of **2**

### eigenvalues with pzlahqr

Posted:

**Tue Mar 06, 2007 4:50 pm**
by **Iana**

Hi,

I need to calculate all the eigenvalues of a large (double) complex matrix. I have a program to do this using LAPACK with a call to zgehrd, followed by a call to zlahqr. The problem is, when I try to emulate the program in SacLAPACK using pzgehrd and pzlahqr, the eigenvalues returned do not match.

I've tried by-passing pzgehrd (by reading in the output of zgehrd instead) and so I know that the problem is isolated to pzlahqr. I've looked at the "current notes / restrictions" section of pzlahqr and tried to satisfy all those conditions, but still no joy.

Does anyone know of any other unrecorded problems with pzlahqr, or something I might be doing wrong?

Thanks,

Ian

### Re: eigenvalues with pzlahqr

Posted:

**Wed Mar 14, 2007 9:09 am**
by **ake**

Iana wrote:Hi,

I need to calculate all the eigenvalues of a large (double) complex matrix. I have a program to do this using LAPACK with a call to zgehrd, followed by a call to zlahqr. The problem is, when I try to emulate the program in SacLAPACK using pzgehrd and pzlahqr, the eigenvalues returned do not match.

I've tried by-passing pzgehrd (by reading in the output of zgehrd instead) and so I know that the problem is isolated to pzlahqr. I've looked at the "current notes / restrictions" section of pzlahqr and tried to satisfy all those conditions, but still no joy.

Does anyone know of any other unrecorded problems with pzlahqr, or something I might be doing wrong?

Ian

There are problems with all p*lahqr when complied with high optimization. Which compiler and flags did you use?

Posted:

**Wed Mar 14, 2007 1:47 pm**
by **Iana**

HI Ake, thanks for the reply

I compiled with the intel fortran compiler (ifort v9.1 20060706) and using the following compiler flags

F77 = mpif77

CC = mpicc

NOOPT = -fltconsistency -fp-port

F77FLAGS = -funroll-loops -O3 $(NOOPT)

DRVOPTS = $(F77FLAGS)

CCFLAGS = -O4

SRCFLAG =

F77LOADER = $(F77)

CCLOADER = $(CC)

F77LOADFLAGS =

CCLOADFLAGS =

I'll try again with a more conservative set of options and see what happens.

Thanks,

Ian.

Posted:

**Wed Mar 14, 2007 8:52 pm**
by **Iana**

Hi,

I've now tried with the following options as well (still using gcc and ifort v9.1)

F77 = mpif77

CC = mpicc

NOOPT = -fltconsistency -fp-port

F77FLAGS = $(NOOPT)

DRVOPTS = $(F77FLAGS)

CCFLAGS = -O2

SRCFLAG =

F77LOADER = $(F77)

CCLOADER = $(CC)

F77LOADFLAGS =

CCLOADFLAGS =

still with no joy. The spectrum is almost correct, but there are some worrying problems. The case I'm investigating has the property that if a is an eigenvalue then so are a*, -a and -a*. Among the eigenvalues returned by pzlahqr, if a is an eigenvalue then so is -a*, but not necessarily -a or a*.

any ideas?

Posted:

**Thu Mar 15, 2007 2:54 am**
by **ake**

Iana wrote:Hi,

I've now tried with the following options as well (still using gcc and ifort v9.1)

F77 = mpif77

CC = mpicc

NOOPT = -fltconsistency -fp-port

F77FLAGS = $(NOOPT)

DRVOPTS = $(F77FLAGS)

CCFLAGS = -O2

SRCFLAG =

F77LOADER = $(F77)

CCLOADER = $(CC)

F77LOADFLAGS =

CCLOADFLAGS =

still with no joy. The spectrum is almost correct, but there are some worrying problems. The case I'm investigating has the property that if a is an eigenvalue then so are a*, -a and -a*. Among the eigenvalues returned by pzlahqr, if a is an eigenvalue then so is -a*, but not necessarily -a or a*.

any ideas?

Not really, but if you could test running that case with a blocking >= N and see what happens. I know its weird but the scalapack test cases indicate that there is a problem here...

Posted:

**Fri Mar 16, 2007 4:26 pm**
by **Iana**

Hi, thanks for the suggestions,

OK, I've tried running with nb=n and nb>n, both return exactly the same results (but still not quite the correct spectrum), also these differ the results with nb < n (which again are still not quite correct).

does this help?

Thanks,

Ian.

Posted:

**Sat Mar 17, 2007 5:12 am**
by **ake**

Iana wrote:Hi, thanks for the suggestions,

OK, I've tried running with nb=n and nb>n, both return exactly the same results (but still not quite the correct spectrum), also these differ the results with nb < n (which again are still not quite correct).

does this help?

Thanks,

Ian.

Yes. I have a set of patches that at least should make sure you get the same result no matter what nb you use. There is probably still a problem with the actual result returned but i'm working on that at least partially.

I'm still testing these patches so i won't send them to anyone just yet.

Posted:

**Sat Mar 17, 2007 10:38 pm**
by **Iana**

Thanks for looking into this. If you want me to test anything, just let me know.

Thanks.

Ian.

Posted:

**Mon Mar 19, 2007 11:52 am**
by **ake**

Iana wrote:Thanks for looking into this. If you want me to test anything, just let me know.

Thanks.

Ian.

I now have something that might be worth testing.

The patch is big (contains lots of fixes not just to lahqr) so i would prefer to send it directly to you.

Whats your adress?

Posted:

**Mon Mar 19, 2007 12:08 pm**
by **Iana**

I've sent my email address to your account as a pm.

Thanks.

Ian.

Posted:

**Tue Mar 20, 2007 1:59 am**
by **Iana**

Hi ake,

Thanks so much! The patches worked perfectly.

All eigenvalues now agree with those calculated using the scalar routines. I've checked with nb=n and nb<n, and all cases agree. I hope you commit those changes as soon as possible.

Thank you for all your help,

Ian.

Posted:

**Tue Mar 20, 2007 2:03 am**
by **ake**

Iana wrote:Hi ake,

Thanks so much! The patches worked perfectly.

All eigenvalues now agree with those calculated using the scalar routines. I've checked with nb=n and nb<n, and all cases agree. I hope you commit those changes as soon as possible.

Thank you for all your help,

Ian.

VERY nice to hear :-)

I will submit them just as soon as i have fixed a few more uses of uninitialized vars in lahqr.

Posted:

**Sat Apr 28, 2007 9:29 pm**
by **reg_1013**

I have the same problem. Thanks all the above! :D

### Re: eigenvalues with pzlahqr

Posted:

**Wed Jul 11, 2012 5:25 am**
by **anto_n**

Hi! I know that this is an old discussion but I have the same problem. Is possible have these patches? Thanking you in advance.

### Re: eigenvalues with pzlahqr

Posted:

**Wed Jul 11, 2012 11:49 am**
by **ake**

As far as i can remember the patches are in versions from 1.8.0 onwards.

The svn log says that it was added 2007-03-29 (r14)