Ahti:

The current versions of LAPACK work differently on Windows and Linux.  I
also erroneously assumed a sort order on the returned eigenvalues, which
appears true for Linux and false for Windows.

I did post a followup on this, but it seems not to have made it to the
archives.

To calculate the principal eigenvalue you need:

require '~addons/lapack/lapack.ijs'
require '~addons/lapack/dgeev.ijs'
la=:3 : 0
'l c r'=.dgeev_jlapack_ y.
({. \: c){"1 r
)

With your example, this gives

      (%+/)la m2
0.0935079 0.152629 0.174427 0.166814 0.154946 0.257677
    (%+/)  power m2
0.0935079 0.152629 0.174427 0.166814 0.154946 0.257677

Please let me know if this works for you.
Best wishes,

John

Ahti Kitsik wrote:
> Most of the matrices produce similar results with LAPACK dgeev and power
> method J-implementation proposed by Mr. John Randall.
>
> However, few of the AHP matrices have LAPACK-produced eigenvector
> half-negative (e.g. _0.685 0.406 _0.414 0.310 0.331 0.043).
> Could someone provide a hint what could be the logical meaning behind
> this? How should one normalize such weight-lists?
>
> Anyway, to the point.
> Following example demonstrates a matrice where powermethod and LAPACK
> dgeev give very different results.
> Am I missing something?
>
> Ahti.
>
>    require jpath '~addons\lapack\lapack.ijs'
>    require jpath '~addons\lapack\dgeev.ijs'
>
>    NB. The power method for calculating the principal eigenvector
>    mp=:+/ . *
>    normalize=:%(>./@:|)
>    iterate=:normalize@:mp
>    init=:[: ? # # 0:
>    power=:13 : 'y.&iterate^:_ init y.'
>
>    m2=: 6 6$1,(%6),(%5),6,(%2),(%2),6 1,(%8),5 4,(%8),5 8
> 1,(%7),4,(%8),(%6),(%5),7 1 6,(%4),2,(%4),(%4),(%6),1 7 2 8 8 4,(%7),1
>    m2
>        1 0.166667   0.2        6      0.5   0.5
>        6        1 0.125        5        4 0.125
>        5        8     1 0.142857        4 0.125
> 0.166667      0.2     7        1        6  0.25
>        2     0.25  0.25 0.166667        1     7
>        2        8     8        4 0.142857     1
>    ]v=:{."1 (2{::dgeev_jlapack_ m2) NB. LAPACK right eigenvector
> _0.675103 0.40594 _0.414364 0.309959 0.331358 0.043336
>    \:v NB. Order
> 1 4 3 5 2 0
>
>    ]p=:power m2
> 0.362889 0.592327 0.676923 0.647377 0.601319 1
>    \:p NB. Order
> 5 2 3 4 1 0
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to