[net.math] matrix diagonalization

edwardd@burdvax.UUCP (Edward Dougherty) (05/02/85)

  I am looking for a utility program that diagonalizes an NxN matrix
(complex), ( also giving the eigenvalues and vectors).

Ed Dougherty
allegra ! psuvax ! burdvax ! edwardd

mvm9745@acf4.UUCP (Michael V. Mascagni) (05/06/85)

/* acf4:net.math / edwardd@burdvax.UUCP (Edward Dougherty) /  2:18 pm  May  2, 1985 */

>  I am looking for a utility program that diagonalizes an NxN matrix
>(complex), ( also giving the eigenvalues and vectors).
>
>Ed Dougherty
>allegra ! psuvax ! burdvax ! edwardd

       Have you ever heard of the QR algorithm for the eigenvalue
       problem?  If you haven't you can look it up in most good
       texts on numerical methods.  The basis of the QR algorithm
       is the iterative QR decompostition of a matrix.  If you
       can't find a package for the QR algorithm as such, you can
       use the LINPACK QR Decomposition routine.  Also LINPACK has
       a singular value decomposition routine, which for an NxN
       matrix computes the right and left eigenvectors and the
       eigenvalues.
                               Good Hunting,
                               Michael Mascagni, CIMS

edwardd@burdvax.UUCP (Edward Dougherty) (05/06/85)

This is further info. on the diagonalization routine I requested:

The matrix is real and tri-diagonal, unfortunately Idon't think its
hermetian but that shouldnt affect the diagonalization routine.

I'm trying to simulate atoms in a laser cavity so N will be greater than
500 hopefully larger.

I hope someone has an efficient routine to run on a VAX,

Thanks,

Ed Dougherty

allegra ! psuvax ! burdvax !edwardd

emigh@ecsvax.UUCP (Ted Emigh) (05/07/85)

A FORTRAN source for the QR algorithm is:
	Lawson, Charles L and R. J. Hanson,  Solving Least Squares
		Problems, Prentice-Hall, 1974.
-- 

Ted H. Emigh     Genetics and Statistics, North Carolina State U, Raleigh  NC
USENET:	{akgua decvax duke ihnp4 unc}!mcnc!ecsvax!emigh
ARPA:	decvax!mcnc!ecsvax!emigh@BERKELEY

jp@lanl.ARPA (05/09/85)

> 
>   I am looking for a utility program that diagonalizes an NxN matrix
> (complex), ( also giving the eigenvalues and vectors).
> 
> Ed Dougherty
> allegra ! psuvax ! burdvax ! edwardd


Somewhere I saw a message that implied that your matrix was tri-diagonal.
If this is the case there is no need to get out the cannon to kill an ant.
Given a set of equations of the form Y = M X where M is tri diagonal, solve
the first equation for x2 in terms of x1, solve the second equation for x3
in terms of x2 and x1, then substitute the value of x2 in terms of x1 from
the previous equation to get x3 in terms of x1.  Continue in this fashion
until you get to the last two equations.  Both of these relate xn to x1.
Solve them for xn and x1, then substitute the value for x1 in all the expressions
for xi  1<i<n and you have it.   I have used this simple technique for linear
chains of oscillators (coupled microwave cavity accelerators).  The technique
can be simply extended to the case of next-nearest neighbor coupling (5-diag-
onal matrices) by carrying thru the calculation in terms of x1 and x2 and
solving a 4X4 matrix at the end.  The problems I calculated with this method
were high Q resonators Q on the order of 10000 to 30000 with coupling factors
(spectra relative bandwidth) on the order of .02 to .1 depending on the
problem.  

To get the eigenvectors it is easiest to eliminate the "losses" and solve
for the squares of the natural frequencies.  This can be done by Newton's
method.  It is relatively easy to calculate the determinant of a tridiadgonal
matrix (this yields the characteristic polynomial which must be zero at the
eigenvalue)  and I once had an algorithm for similarly calculating the derivative
of the determinant.  The only problem I had with this technique was when the
matrix rank was about 8000.  I ran into some overflow problems because of the
magnitude of some of the intermediate coefficients.  This was solved by a trick
which I remember involved renormalizing the results occasionally.

If you are interested in a further discussion of this topic please contact me
by mail or telephone.  I have quite a bit of experience on this particular
problem and variations of it.

Jim Potter  jp@lanl.arpa   (505) 667-9615