- #1

- 426

- 5

Your help would be highly appreciated.

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Hassan2
- Start date

- #1

- 426

- 5

Your help would be highly appreciated.

- #2

AlephZero

Science Advisor

Homework Helper

- 7,002

- 293

You don't invert the matrix explicitly. Instead of multiplying a vector by the matrix to calculate ##y = Ax## you solve the equiations ##Ay = x##. (You want to factorize ##A = LL^T## or ##A = LDL^T## before you start the iterations, or course).

If ##A## is singular, you can add a constant multiple of the unit matrix before you factorize it. If you are finding the eigenvalues ##\lambda_i## of ##(A + cI)^{-1}##, the eigenvalues of ##A## are ##1 / \lambda_i - c##.

If you are solving a generalized eigenproblem ##Kx = \lambda Mx##, and K is singular, you add a multiple of ##M## to ##K## instead of a multiple of ##I##.

- #3

- 426

- 5

- #4

AlephZero

Science Advisor

Homework Helper

- 7,002

- 293

Thanks. It works now, but there is a problem which I think is due to deviation from orthogonality: I have many instances of the same eigenvalue in the final list of eigenvalues.

Remember my post when I said "you really really don't want to write your own Lanczos routine?" You are just start the adventure game of finding out why, if you keep trying!

Warning: I spent a long time on this several years ago, and gave up after several months because my code was never "100% reliable" on new problems.

If you read the literature, there are lots of ways that claim to fix this problem - but only if you can find a a paper that works for your matrices, AND you can understand it!

Have fun.

- #5

- 426

- 5

Thanks for the advice.

Share: