Page 1 of 1

LAPACK ZHEEV Example PROBLEM

Posted: Wed Aug 23, 2017 7:03 am
Hi,

I tried to run the example code given for zheev at the following page:
https://software.intel.com/sites/produc ... v_ex.f.htm

The strange thing is that when I provide the matrix 'A' initialized in the code as follows:

DATA A/
\$ (-3.84, 2.25),(-0.66, 0.83),(-3.99,-4.73),( 7.74, 4.18),
\$ (-8.94,-4.75),(-4.40,-3.82),(-5.88,-6.60),( 3.66,-7.53),
\$ ( 8.95,-6.53),(-3.50,-4.26),(-3.36,-0.40),( 2.58, 3.60),
\$ (-9.87, 4.82),(-3.15, 7.36),(-0.75, 5.23),( 4.59, 5.41)
\$ /

I get exactly the same results reported by the website that is:
eigenvalues:
( -9.43,-12.98) ( -3.44, 12.69) ( 0.11, -3.40) ( 5.76, 7.13)

When I tried to read the same matrix from a file as follows:

file:

-3.84 2.25
-0.66 0.83
-3.99 -4.73
7.74 4.18
-8.94 -4.75
-4.40 -3.82
-5.88 -6.60
3.66 -7.53
8.95 -6.53
-3.50 -4.26
-3.36 -0.40
2.58 3.60
9.87 4.82
-3.15 7.36
-0.75 5.23
4.59 5.41

do i=1,4
do j=1,4
A(j,i)=dcmplx(hreal,himag) ! Column-wise order, I tested A(i,j) as well to see if I am reading it the same way
end do
end do

I got the following eigenvalues:
(-11.22,-11.85) ( 12.78, 7.64) ( -4.70, -1.21) ( -3.87, 8.86)

I tried cmplx rather than dcmplx also, but nothing has changed.

The matrix is the same, the rest of the code is exactly the same. Only thing that changes is the way I provide the matrix yet the eigenvalues change.

Does anyone have a clue about what might be the problem?

I use gnu compilers.

Thanks,