Differences between revisions 4 and 5
 ⇤ ← Revision 4 as of 2007-08-27 15:37:12 → Size: 1825 Editor: RogerHui Comment: ← Revision 5 as of 2008-12-08 10:45:53 → ⇥ Size: 1830 Editor: anonymous Comment: converted to 1.6 markup Deletions are marked like this. Additions are marked like this. Line 52: Line 52: * [:Addons/math/lapack:LAPACK addon] * [:Essays/QR_Decomposition: QR Decomposition essay] * Eugene Mc``Donnell's ''At Play with J'' article [:Doc/Articles/Play141:Oh, No, Not Eigenvalues Again!] * [[Addons/math/lapack|LAPACK addon]] * [[Essays/QR Decomposition| QR Decomposition essay]] * Eugene Mc``Donnell's ''At Play with J'' article [[Doc/Articles/Play141|Oh, No, Not Eigenvalues Again!]] Line 59: Line 59: * [http://www.jsoftware.com/cgi-bin/forumsearch.cgi?all=eigenvalues&exa=&one=&exc=&add=&sub=&fid=&tim=0&rng=0&dbgn=1&mbgn=1&ybgn=1998&dend=31&mend=12¥d=2010 search J forums] for "eigenvalue" * [[http://www.jsoftware.com/cgi-bin/forumsearch.cgi?all=eigenvalues&exa=&one=&exc=&add=&sub=&fid=&tim=0&rng=0&dbgn=1&mbgn=1&ybgn=1998&dend=31&mend=12¥d=2010|search J forums]] for "eigenvalue"

The original text of this page was posted on the forum programming/2007-August/007959 by JohnRandall.

A number of ways for calculating eigenvalues in J have been proposed. It is interesting to compare those methods..

```NB. LAPACK

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^:_

char=: 3 : 0
X=.I=.=@i.n=.#y[p=.1
for_k. >:i.n do.
X=.y +/ . * X
p=.p,pk=.-k%~+/(<0 1)|:X
X=.X+pk*I
end.
|.p
)
lf=:>@{:@p.@char```

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=:*=@i.@# NB. diagonal matrix

(-:ev@dm) >:i.20
1
(-:rh@dm) >:i.20
1
(-:ms@dm) >:i.20
1
(-:lf@dm) >:i.20
0```