I have a problem that I need to sort the generalized eigenvalues on the (quasi) triangular matrices from a QZ decomposition in ascending order by magnitude some times and descending order by magnitude other times.
None of the canned orderings from ordqz fit this need, so I have been attempting to do this in the following way:
[aamat, bbmat, q,z]=qz(amat,bmat);
The above is intended to sort the diagonal from smallest to largest. This never seems to achieve what I'm looking for however. On top of that as i've inspected the clus vector that sort spits out many times that vector has the wrong ordering even though the vector of sorted values is correct.
How do I make this work?