# Finding the correct order of eigenvectors of a parameter-dependent Hermitian matrix

so, I have a symmetric, analytic matrix $$\mathbf{H}(x)$$ ($$x$$ is real). Because $$\mathbf{H}(x)$$ is analytic and $$x$$ is real, it is possible to find analytic functions for the eigenvectors and the eigenvalues of $$\mathbf{H}(x)$$. at $$x=0$$, each eigenvalue $$\vec v_i(0)$$ is associated with an eigenvalue $$\lambda_i(0)$$, where the eigenvalues are ordered $$\lambda_{i}\leq\lambda_{i+1}$$.

As $$x$$ changes, some eigenvector $$\vec v_i(x)$$ "switch place" because the eigenvalues cross. This is illustrated in the following example. The green and grey lines switch place at $$x\approx1.2$$, because I used a diagonalization algorithm that orders the eigenvalues by their values:

Algorithms such as numpy's og scipy's $$\texttt{eigh}$$, of course, do not have information about the function $$\mathbf{H}(x)$$ and simply order the eigenvalues by their value for each $$x$$.

So, my questions are:

1. Does anyone know of a good algorithm to re-order the eigenvector-eigenvalue pair in such a way that they are analytic functions (that is, to "swap green and grey" at $$x\approx1.2$$ etc.?)
2. In my application, I will only have the eigenvalues and eigenvectors for few $$x$$ (I can generate them for more values, but that is expensive), but I still need them in such an order that they are associated with the right function. Hence, the function $$\mathbf{H}(x)$$ is not explicitely available.
3. Some eigenvalues are degenerate for all $$x$$ (in addition to them switching places with other eigenvalues). So, numpy/scipy will return a "random" orthogonal pair of vectors. Of course, the subspace spanned by these eigenvectors will be analytic, but some type of algorithm needs to be applied to make the individual eigenvectors analytic.

What I have been thinking so far:

1. Because the eigenvectors are analytic, when no crossings occur, we have that $$\vec v_i(x)^T \vec v_j(x+\delta x)\approx\delta_{ij}$$. Based on this observation, we can "regain" the correct order. This seems to work pretty well, unlike (Continuity of eigenvectors of parametric matrix), where it seems to have failed.
2. The same answer as 1., where some threshold is used for when more samples need to be obtained.
3. One can use the orthogonal Procrustes algorithm to "similarize" the pair of vectors as much as possible to some arbitrary reference,for example $$x=0$$, though I am not sure whether this will yield analytic eigenvectors.

Before I implement any more of this, it would be nice to hear if someone has a more elegant solution or possibly knows of an implementation in some library (ideally Python).

• After a very quick search I can't find a good reference but you might look into electronic band structure in condensed matter physics, they have exactly this band crossing problem and I am sure have ways to characterize it, but I don't know them off the top of my head. Somebody in the "matter modelling" forum might know. Feb 28 at 7:50
• What do you want to do with the correct ordering? I assume not just "draw a pretty picture with the correct colors". There might be a shortcut to avoid solving this problem. Feb 28 at 9:01
• @FedericoPoloni Well, it's always nice to draw a pretty picture! But generally speaking, I have a function $F(\vec v_1,\dots,\vec v_N)$ that takes the eigenvectors as input and returns a set of parameters $t_{i}$. This set of parameters $t_i$ changes continuously only if the input vectors change continuously, and the ordering is important for that to be the case. More specifically, the parameter $x$ is a geometric perturbation of a molecule, the vectors represent natural orbitals, and I want the resulting Coupled Cluster wave function parameters to change continuously. Mar 1 at 8:26
• Does the geometric perturbation leave the symmetry of the system unchanged? Do the crossing states have different symmetries? Can you work in a symmetry adapted basis which will make it absolutely clear at a given x what the appropriate eval is? Mar 1 at 8:34