Here's a "pure J" solution for the principal eigenvector: no LAPACK
required.   This uses the power method with a random starting value.  It
can fail if the starting value is bad, and for other reasons.

im=:13 : 'y. i. >./ | y.'
imv=:13 : '(im y.) { y.'
iterate=:([: (% imv) mp) f.
peigen=:13 : 'y.&iterate^:_ ?(# y.)#100'

rod=. >(1,(%3),%9);(3,1,%3);9 3 1 NB. "Replication of detail", p. 7

   (%+/) peigen rod
0.0769231 0.230769 0.692308

Best wishes,

John

Devon McCormick wrote:
> This is odd.  Even in a new session, I get
>
> NB. [Session started: 2006 3 1 18 21 37.817]
>    load '~addons/lapack/lapack.ijs'
>    load '~addons/lapack/dgeev.ijs'
>    ]rod=. >(1,(%3),%9);(3,1,%3);9 3 1 NB. "Replication of detail", p. 7
> 1 0.33333333 0.11111111
> 3          1 0.33333333
> 9          3          1
>    (%+/){."1 >2{dgeev_jlapack_ rod
> _0.2 0.3 0.9
>    (9!:12 '');9!:14 ''
> +-+---------------------+
> |6|j504/2005-03-30/13:35|
> +-+---------------------+
>
> Is this a J version or machine difference?
>
> Devon
>
> On 3/1/06, John Randall <[EMAIL PROTECTED]> wrote:
>>
>> Devon McCormick wrote:
>>
>> >    ]rod=. >(1,(%3),%9);(3,1,%3);9 3 1 NB. "Replication of detail", p.
>> 7
>> > 1 0.33333333 0.11111111
>> > 3          1 0.33333333
>> > 9          3          1
>> >    (%+/){."1 >2{dgeev_jlapack_ rod
>> > _0.2 0.3 0.9
>> >    NB. This differs... (vs. 0.077 0.231 0.692)
>>
>> Devon:
>>
>> I get
>>
>>    (%+/){."1 >2{dgeev_jlapack_ rod
>> 0.0769231 0.230769 0.692308
>>
>> which looks OK.
>>
>> Best wishes,
>>
>> John
>>
> ...
> --
> Devon McCormick
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> 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