Actually I think eig with 2 inputs is more approprite for multiple order eigen value and the degenerate case to non trivial jordan form The Schur decomposition (using diferent left and right orthogonal on left and right side of the decompositopns) reveals the jordan form:
A = [-z, -z^2/z1; z1, z];
TA
TA =
0.0000 - 0.0000i -2.8868 - 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i
TA1termedia2 = TA(1,2)
TA1termedia2 = -2.8868 - 0.0000i
Now how on earth by which miracle an intermediate errd of 3e-8 lead to even more accurate (the error get squared) final eigen values
eig(A,I,"qz")
ans =
1.0e-16 *
-0.3392
-0.7022
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
I have no idea !
QR algorithm used by EIG with single input can be viewed as some sort of power iterative method and less performant to reveal jordan block structure of the matrix.
Not tested but note that another algorithm branch of generalized eig is possible using cholesky decompolizion in case both matrix is symmetric and the second one is positive, I think it is also robust to multiplicity as the theory says the eigen vectors are orthogonal and numerical method will enforce it.
So I change my opinion : better use EIG with 2 arguments (generalized) for repeat eigen value case. Torsen have found a good trick here.