# Compute all eigenvalues of orthogonal-like matrix

First, what I call a orthogonal-like matrix is a matrix which verifies $$A^T \times A = diag(n_0,n_1,...,n_k)$$ where $$n_i$$ are real constants. For example, this matrix : $$\left(\begin{array}{ccc} 0 & 5 & 0\\ 0 & 0 & 2\\ 3 & 0 & 0\end{array}\right)$$

I'm currently using QR algorithm to find all eigenvalues of a matrix, but there is a problem with "orthogonal-like" ones : the iterative solution will not converge.

Here is a python script of the QR algorithm :

import numpy as np

a = np.array(((
(0,5,0),
(0,0,2),
(3,0,0)
)))

while 1:
q,r=np.linalg.qr(a)
a = r@q
print('Iterative sol :\n',a.round(6))
input('Hit [Enter] to continue')

So i'm trying to find another solution : either a different algorithm, or a trick to modify this algorithm in order to get an expected solution matrix (with a maximum size of 2 for sub-matrix on the diagonal - representing the complex solution).

All I know for now (not sure, but seems like to me) :

• the R matrix is always diagonal for such matrices.

Thank you for your help!

P.S. An expected solution matrix (for QR algorithm) is for example :

21.3589   -5.6678   10.0809   -2.3429   -5.0900
0   -1.9810    8.7273   -6.2583   -3.8582
0   -5.1169   -1.9810   -0.3539   -1.8999
0         0         0    1.2580   -0.3232
0         0         0         0    4.3450
• Why are you trying to develop your own algorithm while there are many efficient algorithms out there for computing eigenvalues?
– KBS
Commented Mar 15, 2022 at 18:57
• @KBS My goal is first be able to (undertand how to) compute all eigenvalues for any real input matrix, and then "translate the code" to a scientific calculator (Casio fx-9750G). This topic is the only "issue" (QR algorithm does not converge) I have wih both implemented codes (PC and calculator). Commented Mar 15, 2022 at 22:40
• Have you looked at Arnoldi algorithm?
– KBS
Commented Mar 16, 2022 at 2:21
• Never, no. Even the Wikipedia page of iterative method to find eigenvalues does not mention it (en.m.wikipedia.org/wiki/Eigenvalue_algorithm). Thanks for the suggestion, I'll dig in! Commented Mar 16, 2022 at 10:59
• For eigenvalues problems, it is better to look at research papers or books on the topic rather than Wikipedia. The book by Saad, "Numerical Methods for Large Eigenvalue Problems" is a good starting point. It is available for free there: www-users.cse.umn.edu/~saad/eig_book_2ndEd.pdf
– KBS
Commented Mar 16, 2022 at 12:40