Roger Hui wrote:
>    eval1=: +/ .*&>/@|.&(128!:0)

It is interesting to compare the various eigenvalue methods that have
been proposed.

NB. LAPACK

require '~addons/math/lapack/lapack.ijs'
require '~addons/math/lapack/dgeev.ijs'
ev=:[: clean_jlapack_ 1 >@{ dgeev_jlapack_

NB. Iterative QR algorithm

rheval=:+/ .*&>/@|.&(128!:0) NB. Roger Hui
rh=: [: (<0 1)&|: rheval ^:_

mseval=:(>&(1&{) +/ .* >&(0&{))&(128!:0)  NB. M. Shimura
ms=:[: (<0 1)&|: mseval ^:_


NB. Leverrier-Faddeev Algorithm
char=: 3 : 0
[EMAIL PROTECTED]
for_k. >:i.n do.
 X=.y +/ . * X
 p=.p,pk=.-k%~+/(<0 1)|:X
 X=.X+pk*I
end.
|.p
)
lf=:>@{:@[EMAIL PROTECTED]


The LAPACK method is a direct method, but does preconditioning.

The QR method is iterative, and so is able to get past small
instabilities.

Methods which find the characteristic polynomial, like the LF method,
work well on small examples, but because of the instability of finding
polynomial roots, may go wrong with large examples.

   dm=:[EMAIL PROTECTED]@# NB. diagonal matrix

   (-:[EMAIL PROTECTED]) >:i.20
1
   (-:[EMAIL PROTECTED]) >:i.20
1
   (-:[EMAIL PROTECTED]) >:i.20
1
   (-:[EMAIL PROTECTED]) >:i.20
0

Best wishes,

John



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

Reply via email to