### eigen vector solving with dsyev driver routine.

Posted:

**Tue Apr 25, 2006 7:22 am**Hi all..

I'm novice for Lapack.. now i'm trying to solve principal compoent analysis(PCA) with dsyev driver routine.

i use clapack on windows with VC++6.0

i hope making a pca routine like pcacov or princomp in matlab.

with dsyev routine the eigen values produce properly, but in eigen vectors is not same as matlab results.

Q1. 3*3 sysmetric matrix

input matrix A = cov(A) in matlab

1.3333 1.6667 5.6667

1.6667 14.3333 26.3333

5.6667 26.3333 54.3333

* results of matlab pcacov(A)

ans =

-0.0871 0.6257 0.7752

-0.4416 -0.7218 0.5330

-0.8930 0.2959 -0.3392

* results of dsyev routine of A

ans =

0.7752 0.6257 -0.0871

0.5330 -0.7218 -0.4416

-0.3392 0.2959 -0.8930

==> this time col1,col3 switched. Why?

Q2. 4*4 sysmetric matrix

input matrix A = cov(A) in matlab

1.5600 0.7100 0.7100 1.8700

0.7100 1.4633 1.4633 -3.0433

0.7100 1.4633 1.4633 -3.0433

1.8700 -3.0433 -3.0433 15.5433

* results of matlab pcacov(A)

ans=

-0.0969 -0.6817 0.4924 -0.5324

0.2011 -0.5071 -0.8246 -0.1499

0.2011 -0.5071 0.2137 0.8104

-0.9538 -0.1446 -0.1788 0.1934

* results of dsyev routine of A

ans =

-0.2545 0.6791 0.6817 -0.0969

0.8200 -0.1731 0.5071 0.2011

-0.5043 -0.6693 0.5071 0.2011

0.0924 -0.2467 0.1446 0.9538

=> this time just col3,col4 switched. col1,col2 is not same. Why?

I use jobz='V', uplo='L' and working arrary size=3*N.

the result of INFO value is 0..

Q3. am i right using dsyev routine to get eigen value & eigen vectors?

if not, could you show me the way?

thanks for all^^..

I'm novice for Lapack.. now i'm trying to solve principal compoent analysis(PCA) with dsyev driver routine.

i use clapack on windows with VC++6.0

i hope making a pca routine like pcacov or princomp in matlab.

with dsyev routine the eigen values produce properly, but in eigen vectors is not same as matlab results.

Q1. 3*3 sysmetric matrix

input matrix A = cov(A) in matlab

1.3333 1.6667 5.6667

1.6667 14.3333 26.3333

5.6667 26.3333 54.3333

* results of matlab pcacov(A)

ans =

-0.0871 0.6257 0.7752

-0.4416 -0.7218 0.5330

-0.8930 0.2959 -0.3392

* results of dsyev routine of A

ans =

0.7752 0.6257 -0.0871

0.5330 -0.7218 -0.4416

-0.3392 0.2959 -0.8930

==> this time col1,col3 switched. Why?

Q2. 4*4 sysmetric matrix

input matrix A = cov(A) in matlab

1.5600 0.7100 0.7100 1.8700

0.7100 1.4633 1.4633 -3.0433

0.7100 1.4633 1.4633 -3.0433

1.8700 -3.0433 -3.0433 15.5433

* results of matlab pcacov(A)

ans=

-0.0969 -0.6817 0.4924 -0.5324

0.2011 -0.5071 -0.8246 -0.1499

0.2011 -0.5071 0.2137 0.8104

-0.9538 -0.1446 -0.1788 0.1934

* results of dsyev routine of A

ans =

-0.2545 0.6791 0.6817 -0.0969

0.8200 -0.1731 0.5071 0.2011

-0.5043 -0.6693 0.5071 0.2011

0.0924 -0.2467 0.1446 0.9538

=> this time just col3,col4 switched. col1,col2 is not same. Why?

I use jobz='V', uplo='L' and working arrary size=3*N.

the result of INFO value is 0..

Q3. am i right using dsyev routine to get eigen value & eigen vectors?

if not, could you show me the way?

thanks for all^^..