Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - PDL::Slatec Problem of eigenvalue of Matrix

 
Thread Tools Search this Thread
Old 07-10-2003, 04:10 AM   #1
Default PDL::Slatec Problem of eigenvalue of Matrix


I have installed the PDL module and use it to calculate eigenvalue of
a
matrix. The PDL do gives me some eigenvalue and eigenvector. But the
problem is that these values are different from the eigenvalue and
eigenvector calculated in Matlab.

A simple example is:

use PDL::LiteF;
my $mat = pdl [ 3.4603 , 1.7529 , 1.6990 , 2.1181],
[ 2.5459 , 2.5615 , 2.2525 , 2.3606],
[ 2.3606 , 2.2515 , 2.5628 , 2.5459],
[ 2.1181 , 1.6982 , 1.7537 , 3.4603];
($eigvals,$eigvecs) = eigsys($mat);
print $eigvecs,$eigvals,"\n";


The results are:

For PDL module is:
[
[0.0541307 -0.554549 0.789897 -0.256142]
[0.0412208 0.635852 0.202431 -0.743649]
[ 0.87661 -0.252953 -0.320313 -0.254888]
[-0.476366 -0.473479 -0.482167 -0.562502]
] and eigenvalue
[0.272291 0.63145 1.7178 9.42336]


But for matlab, the results are

-0.4788 -0.6962 0.4294 -0.0371
-0.5203 -0.1238 -0.5616 0.7063
-0.5203 0.1239 -0.5619 -0.7059
-0.4788 0.6961 0.4295 0.0370
and the eigenvalue is


9.3294 0 0 0
0 1.3519 0 0
0 0 1.0631 0
0 0 0 0.3004


As you can see, the results from PDL is greatly different from Matlab.
So is my installation not correct? or something wrong with my perl
script?

Could somebody who has the PDL installed try this simple example, and
tell me
what is you eigenvalue and eigenvector?

Thanks


Junmou Zhang
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump