\documentclass[]{iopart}

\usepackage[utf8]{inputenc} % why not type "Stokes" with unicode?
\usepackage[T1]{fontenc} % vector fonts
\usepackage[
  colorlinks=true,
  urlcolor=purple,
  citecolor=purple,
  filecolor=purple,
  linkcolor=purple
]{hyperref} % ref and cite links with pretty colors
\usepackage{amsopn, amssymb, graphicx, xcolor} % standard packages
\usepackage[subfolder]{gnuplottex} % need to compile separately for APS

\begin{document}

\title{Analytic continuation over complex landscapes}

\author{Jaron Kent-Dobias and Jorge Kurchan}

\address{Laboratoire de Physique de l'Ecole Normale Supérieure, Paris, France}

\begin{abstract}
  In this paper we follow up the study of `complex complex landscapes'
  \cite{Kent-Dobias_2021_Complex}, rugged landscapes of many complex
  variables.  Unlike real landscapes, there is no useful classification of
  saddles by index. Instead, the spectrum at critical points determines their
  tendency to trade topological numbers under analytic continuation of the
  theory. These trades, which occur at Stokes points, proliferate when the
  spectrum includes marginal directions and are exponentially suppressed
  otherwise. This gives a direct interpretation of the `threshold' energy---which
  in the real case separates saddles from minima---where the spectrum of
  typical critical points develops a gap. This leads to different consequences
  for the analytic continuation of real landscapes with different structures:
  the global minima of ``one step replica-symmetry broken'' landscapes lie
  beyond a threshold and are locally protected from Stokes points, whereas
  those of ``many step replica-symmetry broken'' lie at the threshold and
  Stokes points immediately proliferate.
\end{abstract}

\maketitle

\section{Preamble}

Complex landscapes are basically functions of many variables having many minima and, inevitably,
many saddles of all indices, i.e. the number of unstable directions. Optimization problems 
require us to find the deepest minima, often a difficult task.
For example, particles with a repulsive mutual potential enclosed in a box will have many stable
configurations, and we are asked to find the one with lowest energy.

An aim of complexity theory is to be able to classify these landscapes in families having
common properties. Two simplifications make the task potentially tractable. The first is to consider
the limit of many variables. In the example of the particles, the limit of many particles (i.e. the thermodynamic limit)
may be expected to bring about simplifications.
The second simplification is of more technical nature:  we consider  functions that contain some random element to them, and we
study the average of an ensemble. The paradigm of this is the spin-glass, where the interactions are random, and we are asked to find the
ground state energy {\em on average over randomness}.

Spin glass theory gave a surprise: random   landscapes come in two kinds:  those that
have a `threshold level' of energy, below which there are many minima but no saddles, 
separated by high barriers, and those that have all sorts of saddles all the way down to the lowest 
energy levels, and local minima are separated by relatively small barriers.
The latter are still complex, but good solutions are easier to find.
This classification is closely related to the structure of their Replica Trick solutions.
Armed with this solvable (random) example, it was easy to find non-random examples 
that behave, at least approximately,  in these two ways (e.g. sphere packings and the Travelling salesman Problem,
belong to first and second classes, respectively).

What about systems whose variables are not real, but rather complex? 
Recalling the Cauchy-Riemann conditions, we immediately see a difficulty: if our cost is, say, the real part of a function of
$N$ complex variables, in terms of the corresponding $2N$ real variables it has only saddles of index $N$!
Even worse: often not all saddles are equally interesting, so simply finding the lowest is not usually what we
need to do (more about this below).
As it turns out, there is a set of interesting questions to ask, as we describe below. For each saddle, there is a `thimble' 
spanned by the
lines along which the cost function decreases. The way in which these thimbles fill the complex space is crucial for many
problems of analytic continuation, and is thus what we need to study. The central role played by saddles
in a real landscape, the `barriers', is now played by the Stokes lines, where thimbles exchange their properties. 
Perhaps not surprisingly, the two classes of real landscapes described above retain their role in the complex case, but now  
the distinction is that while in the first class the Stokes lines are rare, in the second class they proliferate.

In  this paper we shall start from a many-variable integral of a real function, and deform it in the many variable complex space.
The landscape one faces is the full one in this space, and we shall see that this is an example where the proliferation -- or lack of it -- 
of Stokes lines is the interesting quantity  in this context.


\section{Introduction}

Analytic continuation of physical theories is sometimes useful. Some theories
have a well-motivated hamiltonian or action that nevertheless results in a
divergent partition function, and can only be properly defined by continuation
from a parameter regime where everything is well-defined \cite{}. Others result
in oscillatory phase space measures that spoil the use of Monte Carlo or saddle
point techniques, but can be treated in a regime where the measure does not
oscillated and the results continued to the desired model \cite{}.

In any case, the nicest modern technique (which we will describe in some detail
later) consists of deforming the phase space integral into a complex phase
space and then breaking it into pieces associated with stationary points of the
action. Each of these pieces, known as \emph{thimbles}, has wonderful
properties that guarantee convergence and prevent oscillations. Once such a
decomposition is made, analytic continuation is mostly easy, save for instances
where the thimbles interact, which must be accounted for.

When your action has a manageable set of stationary points, this process is
usually tractable. However, many actions of interest are complex, having many
stationary points with no simple symmetry relating them, far too many to
individually monitor. Besides appearing in classical descriptions of structural
and spin glasses, complex landscapes are recently become important objects of
study in the computer science of machine learning, the condensed matter theory
of strange metals, and the high energy physics of black holes. What becomes of
analytic continuation under these conditions?

\section{Thimble integration and analytic continuation}

\subsection{Decomposition of the partition function into thimbles}

Consider an action $\mathcal S$ defined on the (real) phase space $\Omega$. A
typical calculation stems from the partition function
\begin{equation} \label{eq:partition.function}
  Z(\beta)=\int_\Omega ds\,e^{-\beta\mathcal S(s)}
\end{equation}
We've defined $Z$ in a way that strongly suggests application in statistical
mechanics, but everything here is general: the action can be complex- or even
imaginary-valued, and $\Omega$ could be infinite-dimensional. In typical
contexts, $\Omega$ will be the euclidean real space $\mathbb R^N$ or some
subspace of this like the sphere $S^{N-1}$ (as in the $p$-spin spherical models
we will study later). We will consider only the analytic continuation of the
parameter $\beta$, but any other would work equally well, e.g., of some
parameter inside the action. The action will have some stationary points, e.g.,
minima, maxima, saddles, and the set of those points in $\Omega$ we will call
$\Sigma_0$, the set of real stationary points.

In order to analytically continue \eref{eq:partition.function} by the method we
will describe, $\mathcal S$ must have an extension to a holomorphic function on
a larger complex phase space $\tilde\Omega$ containing $\Omega$. In many cases
this is accomplished by simply noticing that the action is some sum or product
of holomorphic functions, e.g., polynomials. For $\mathbb R^N$ the complex
phase space $\tilde\Omega$ will be $\mathbb C^N$, while for the sphere
$S^{N-1}$ it takes a little more effort. $S^{N-1}$ can be defined by all points
$x\in\mathbb R^N$ such that $x^Tx=1$. A complex extension of the sphere is made
by extending this constraint: all points $z\in \mathbb C^N$ such that $z^Tz=1$.
Both cases are complex manifolds and moreover Kähler manifolds, since they
are defined by holomorphic constraints, and therefore admit a hermitian
metric and a symplectic structure. In the extended complex phase space, the
action potentially has more stationary points. We'll call $\Sigma$ the set of
\emph{all} stationary points of the action, which naturally contains the set of
\emph{real} stationary points $\Sigma_0$.

Assuming $\mathcal S$ is holomorphic (and that the phase space $\Omega$ is
orientable, which is usually true) the integral in \eref{eq:partition.function}
can be considered an integral over a contour in the complex phase space $\tilde\Omega$,
or
\begin{equation} \label{eq:contour.partition.function}
  Z(\beta)=\oint_\Omega dz\,e^{-\beta\mathcal S(z)}
\end{equation}
For the moment this translation has only changed some of our symbols from
\eref{eq:partition.function}, but conceptually it is very important: contour
integrals can have their contour freely deformed (under some constraints)
without changing their value. This means that we are free to choose a nicer
contour than our initial phase space $\Omega$.

What contour properties are desirable? Consider the two main motivations cited
in the introduction for performing analytic continuation in the first place: we
want our partition function to be well-defined, e.g., for the phase space
integral to converge, and we want to avoid oscillations in the phase of the
integrand. The first condition, convergence, necessitates that the real part of
the action $\operatorname{Re}\beta\mathcal S$ be bounded from below, and that it
approach infinity in any limiting direction along the contour. The second,
constant phase, necessitates that the imaginary part of the action
$\operatorname{Im}\beta\mathcal S$ be constant.

Remarkably, there is an elegant recipe for accomplishing both these criteria at
once, courtesy of Morse theory. For a more thorough review, see
\cite{Witten_2011_Analytic}. We are going to construct our deformed contour out
of a collection of pieces called \emph{Lefschetz thimbles}, or just thimbles.
There is one thimble $\mathcal J_\sigma$ associated with each of the stationary
points $\sigma\in\Sigma$ of the action, and it is defined by all points that
approach the stationary point $z_\sigma$ under gradient descent on
$\operatorname{Re}\beta\mathcal S$.

Thimbles guarantee convergent integrals by construction: the value of
$\operatorname{Re}\beta\mathcal S$ is bounded from below on the thimble $\mathcal J_\sigma$ by its value
$\operatorname{Re}\beta\mathcal S(z_\sigma)$ at the stationary point,
since all other points on the thimble must descend to reach it. And, as we will
see in a moment, thimbles guarantee constant phase for the integrand as well, a
result of the underlying complex geometry of the problem.

What thimbles are necessary to reproduce our original contour, $\Omega$? The
answer is, we need the minimal set which produces a contour between the same
places. Simply stated, if $\Omega=\mathbb R$ produced a phase space integral
running along the real line from left to right, then our contour must likewise
take one continuously from left to right, perhaps with detours to well-behaved
places at infinity (see Fig.~\ref{fig:1d.thimble}). The less simply stated versions follows.

Let $\tilde\Omega_T$ be the set of all points $z\in\tilde\Omega$ such that
$\operatorname{Re}\beta\mathcal S(z)\geq T$, where we will take $T$ to be a very,
very large number. $\tilde\Omega_T$ is then the parts of the manifold where it
is safe for any contour to end up if it wants its integral to converge, since
these are the places where the real part of the action is very large and the
integrand vanishes exponentially. The relative homology group
$H_N(\tilde\Omega,\tilde\Omega_T)$ describes the homology of cycles which begin
and end in $\Omega_T$, i.e., are well-behaved. Therefore, any well-behaved
cycle must represent an element of $H_N(\tilde\Omega,\tilde\Omega_T)$. In order
for our collection of thimbles to produce the correct contour, the composition
of the thimbles must represent the same element of this relative homology
group.

\begin{figure}
  \includegraphics{figs/thimble_homology.eps}
  \hfill
  \includegraphics{figs/antithimble_homology.eps}

  \caption{
    A demonstration of the rules of thimble homology. Both figures depict the
    complex-$\theta$ plane of an $N=2$ spherical $3$-spin model. The black
    symbols lie on the stationary points of the action, and the grey regions
    depict the sets $\tilde\Omega_T$ of well-behaved regions at infinity (here
    $T=5$). (Left) Lines show the thimbles of each stationary point. The
    thimbles necessary to recreate the cyclic path from left to right are
    darkly shaded, while those unnecessary for the task are lightly shaded.
    Notice that all thimbles come and go from the well-behaved regions. (Right)
    Lines show the antithimbles of each stationary point. Notice that those of
    the stationary points involved in the contour (shaded darkly) all intersect
    the desired contour (the real axis), while those not involved do not
    intersect it.
  } \label{fig:thimble.homology}
\end{figure}

Each thimble represents an element of the relative homology, since each thimble
is a contour on which the real part of the action diverges in any direction.
And, thankfully for us, Morse theory on our complex manifold $\tilde\Omega$
implies that the set of all thimbles produces a basis for this relative
homology group, and therefore any contour can be represented by some
composition of thimbles! There is even a systematic way to determine the
contribution from each thimble: for the stationary point $\sigma\in\Sigma$, let
$\mathcal K_\sigma$ be its \emph{antithimble}, defined by all points brought to
$z_\sigma$ by gradient \emph{ascent} (and representing an element of the
relative homology group $H_N(\tilde\Omega,\tilde\Omega_{-T})$). Then each
thimble $\mathcal J_\sigma$ contributes to the contour with a weight given by
its intersection pairing $n_\sigma=\langle\mathcal C,\mathcal K_\sigma\rangle$.

With these tools in hands, we can finally write the partition function as a sum
over contributions from each thimble, or
\begin{equation} \label{eq:thimble.integral}
  Z(\beta)=\sum_{\sigma\in\Sigma}n_\sigma\oint_{\mathcal J_\sigma}dz\,e^{-\beta\mathcal S(z)}.
\end{equation}
Under analytic continuation, the form of \eref{eq:thimble.integral}
generically persists. When the relative homology of the thimbles is unchanged
by the continuation, the integer weights are likewise unchanged, and one can
therefore use the knowledge of these weights in one regime to compute the
partition function in the other. However, their relative homology can change,
and when this happens the integer weights can be traded between stationary
points. These trades occur when two thimbles intersect, or alternatively when
one stationary point lies in the gradient descent of another. These places are
called \emph{Stokes points}, and the gradient descent trajectories that join
two stationary points are called \emph{Stokes lines}. An example of this
behavior can be seen in Fig.~\ref{fig:1d.stokes}.

\begin{figure}
  \includegraphics{figs/thimble_stokes_1.pdf}\hfill
  \includegraphics{figs/thimble_stokes_2.pdf}\hfill
  \includegraphics{figs/thimble_stokes_3.pdf}

  \caption{
    An example of a Stokes point. (Left) The collection of thimbles necessary
    to progress around from left to right, highlighted in a darker color, is
    the same as it was in Fig.~\ref{fig:thimble.homology}. (Center) The thimble
    $\mathcal J_\blacklozenge$ intersects the stationary point $\blacktriangle$
    and its thimble, leading to a situation where the contour is not easily
    defined using thimbles. This is a Stokes point. (Right) The Stokes point
    has passed, and the collection of thimbles necessary to produce the path
    has changed: now $\mathcal J_\blacktriangle$ must be included. Notice that
    in this figure, because of the symmetry of the pure models, the thimble
    $\mathcal J_\blacksquare$ also experiences a Stokes point, but this does
    not result in a change to the path involving that thimble.
  } \label{fig:1d.stokes}
\end{figure}

The prevalence (or not) of Stokes points in a given continuation, and whether
those that do appear affect the weights of critical points of interest, is a
concern for the analytic continuation of theories. If they do not occur or
occur order-one times, one could reasonably hope to perform such a procedure.
If they occur exponentially often in the system size, there is little hope of
keeping track of the resulting weights, and analytic continuation is intractable.

\subsection{Gradient flow and the structure of thimbles}

The `dynamics' describing thimbles is defined by gradient descent on the real
part of the action, with a given thimble incorporating all trajectories which
asymptotically flow to its associated stationary point. Since our phase space
is not necessary flat (as for the \emph{spherical} $p$-spin models), we will
have to do a bit of differential geometry to work out their form. Gradient
descent on a complex (Kähler) manifold is given by
\begin{equation} \label{eq:flow.coordinate.free}
  \dot s
  =-\operatorname{grad}\operatorname{Re}\beta\mathcal S
  =-\left(\frac\partial{\partial s^*}\operatorname{Re}\beta\mathcal S\right)^\sharp
  =-\frac{\beta^*}2\frac{\partial\mathcal S^*}{\partial s^*}g^{-1}\frac\partial{\partial s}
\end{equation}
where $g$ is the metric and the holomorphicity of the action was used to set
$\partial\mathcal S/\partial s^*=0$. If the complex phase space is $\mathbb C^N$ and the
metric is diagonal, this means that the flow is proportional to the conjugate
of the gradient, or $\dot s\propto-\beta^*(\partial S/\partial s)^*$.

In the cases we will consider here (namely, that of the spherical models), it
will be more convenient to work in terms of coordinates in a flat embedding
space than in terms of local coordinates in the curved space, e.g., in terms of
$z\in\mathbb C^N$ instead of $s\in S^{N-1}$. Let $z:\tilde\Omega\to\mathbb C^N$
be an embedding of complex phase space into complex euclidean space. The
dynamics in the embedding space is given by
\begin{equation}\label{eq:flow.raw}
  \dot z
  =-\frac{\beta^*}2\frac{\partial\mathcal S^*}{\partial z^*}(Dz)^* g^{-1}(Dz)^T\frac\partial{\partial z}
\end{equation}
where $Dz=\partial z/\partial s$ is the Jacobian of the embedding.
The embedding induces a metric on $\tilde\Omega$ by $g=(Dz)^\dagger Dz$.
Writing $\partial=\partial/\partial z$, this gives
\begin{equation} \label{eq:flow}
  \dot z=-\frac{\beta^*}2(\partial\mathcal S)^\dagger(Dz)^*[(Dz)^\dagger(Dz)]^{-1}(Dz)^T
  =-\frac12(\partial \mathcal S)^\dagger P
\end{equation}
which is nothing but the projection of $(\partial\mathcal S)^*$ into the
tangent space of the manifold, with the projection operator
$P=(Dz)^*[(Dz)^\dagger(Dz)]^{-1}(Dz)^T$. Note that $P$ is hermitian. For the spherical models, where $\tilde\Omega$ is the complex phase spaced defined by all points $z\in\mathbb C^N$ such that $z^Tz=1$, the projection operator is given by
\begin{equation}
  P=I-\frac{zz^\dagger}{|z|^2}
\end{equation}
something that we be worked out in detail in a following section. One can
quickly verify that this operator indeed projects the dynamics onto the
manifold: its tangent at any point $z$ is given by $\partial(z^Tz)=z$, and
$Pz=z-z|z|^2/|z|^2=0$. For any vector $u$ perpendicular to $z$, i.e.,
$z^\dagger u=0$, $Pu=u$.

Gradient descent on $\operatorname{Re}\beta\mathcal S$ is equivalent to
Hamiltonian dynamics with the Hamiltonian $\operatorname{Im}\beta\mathcal S$
and conjugate coordinates given by the real and imaginary parts of each complex
coordinate. This is because $(\tilde\Omega, g)$ is Kähler and therefore admits
a symplectic structure, but that the flow conserves
$\operatorname{Im}\beta\mathcal S$ can be shown using \eref{eq:flow} and the
holomorphic property of $\mathcal S$:
\begin{eqnarray}
  \frac d{dt}\operatorname{Im}\beta\mathcal S
  &=\dot z\partial\operatorname{Im}\beta\mathcal S+\dot z^*\partial^*\operatorname{Im}\beta\mathcal S \\
  &=\frac i4\left(
    (\beta\partial \mathcal S)^\dagger P\beta\partial\mathcal S-(\beta\partial\mathcal S)^TP^*(\beta\partial\mathcal S)^*
  \right) \\
  &=\frac{i|\beta|^2}4\left(
    (\partial\mathcal S)^\dagger P\partial\mathcal S-[(\partial\mathcal S)^\dagger P\partial\mathcal S]^*
  \right) \\
  &=\frac{i|\beta|^2}4\left(
    \|\partial\mathcal S\|^2-(\|\partial\mathcal S\|^*)^2
  \right)=0.
\end{eqnarray}
A consequence of this conservation is that the flow in the action takes a
simple form:
\begin{equation}
  \dot{\mathcal S}
  =\dot z\partial\mathcal S
  =-\frac{\beta^*}2(\partial\mathcal S)^\dagger P\partial\mathcal S
  =-\frac{\beta^*}2\|\partial\mathcal S\|^2.
\end{equation}
In the complex-$\mathcal S$ plane, dynamics is occurs along straight lines in
a direction set by the argument of $\beta$.

What does the topology of the space of thimbles look like?  Let us consider the
generic case, where the critical points of $\beta\mathcal S$ have distinct
energies. Consider initially the situation in the absence of any critical
point, e.g., as for a constant or linear function. Now, `place' a generic
(nondegenerate) critical point in the function at $z_0$. In the vicinity of the
critical point, the flow is locally
\begin{equation}
  \dot z
  \simeq-\frac{\beta^*}2(\partial\partial\mathcal S|_{z=z_0})^\dagger P(z-z_0)^*
\end{equation}
The matrix $(\partial\partial\mathcal S)^\dagger P$ has a spectrum identical to that of
$(\partial\partial\mathcal S)^\dagger$ save marginal directions corresponding to the normals to
manifold. Assuming we are working in a diagonal basis, this becomes
\begin{equation}
  \dot z_i=-\frac12(\beta\lambda_i)^*\Delta z_i^*+O(\Delta z^2,(\Delta z^*)^2)
\end{equation}
Breaking into real and imaginary parts gives
\begin{eqnarray}
  \frac{d\Delta x_i}{dt}&=-\frac12\left(
    \operatorname{Re}\lambda_i\Delta x_i+\operatorname{Im}\beta\lambda_i\Delta y_i
  \right) \\
  \frac{d\Delta y_i}{dt}&=-\frac12\left(
    \operatorname{Im}\lambda_i\Delta x_i-\operatorname{Re}\beta\lambda_i\Delta y_i
  \right)
\end{eqnarray}
Therefore, in the complex plane defined by each eigenvector of
$(\partial\partial\mathcal S)^\dagger P$ there is a separatrix flow of the form in
Figure \ref{fig:local_flow}. The effect of these separatrices in each complex
direction of the tangent space $T_{z_0}M$ is to separate that space into four
quadrants: two disconnected pieces with greater imaginary part than the
critical point, and two with lesser imaginary part. This partitioning implies
that the level set of $\operatorname{Im}\mathcal S=C$ for
$C\neq\operatorname{Im}\mathcal S(z_0)$ is split into two disconnected pieces, one
lying in each of two quadrants corresponding with its value relative to that at
the critical point.

\begin{figure}
  \includegraphics{figs/local_flow.pdf}
  \caption{
    Gradient descent in the vicinity of a critical point, in the $z$--$z^*$
    plane for an eigenvector $z$ of $(\partial\partial\mathcal S)^\dagger P$. The flow
    lines are colored by the value of $\operatorname{Im}H$.
  } \label{fig:local_flow}
\end{figure}

Continuing to `insert' critical points whose imaginary energy differs from $C$,
one repeatedly partitions the space this way with each insertion. Therefore,
for the generic case with $\mathcal N$ critical points, with $C$ differing in
value from all critical points, the level set $\operatorname{Im}\mathcal S=C$ has
$\mathcal N+1$ connected components, each of which is simply connected,
diffeomorphic to $\mathbb R^{2D-1}$ and connects two sectors of infinity to
each other.

When $C$ is brought to the same value as the imaginary part of some critical
point, two of these disconnected surfaces pinch grow nearer and pinch together
at the critical point when $C=\operatorname{Im}\mathcal S$, as in the black lines of
Figure \ref{fig:local_flow}. The unstable manifold of the critical point, which
corresponds with the portion of this surface that flows away, produce the
Lefschetz thimble associated with that critical point.

Stokes lines are trajectories that approach distinct critical points as time
goes to $\pm\infty$. From the perspective of dynamics, these correspond to
\emph{heteroclinic orbits}. What are the conditions under which Stokes lines
appear? Because the dynamics conserves imaginary energy, two critical points
must have the same imaginary energy if they are to be connected by a Stokes
line. This is not a generic phenomena, but will happen often as one model
parameter is continuously varied. When two critical points do have the same
imaginary energy and $C$ is brought to that value, the level set
$C=\operatorname{Im}\mathcal S$ sees formally disconnected surfaces pinch together in
two places. We shall argue that generically, a Stokes line will exist whenever
the two critical points in question lie on the same connected piece of this
surface.

What are the ramifications of this for disordered Hamiltonians? When some
process brings two critical points to the same imaginary energy, whether a
Stokes line connects them depends on whether the points are separated from each
other by the separatrices of one or more intervening critical points.
Therefore, we expect that in regions where critical points with the same
energies tend to be nearby, Stokes lines will proliferate, while in regions
where critical points with the same energies tend to be distant compared to
those with different energies, Stokes lines will be rare.

\section{Analytic continuation}

\begin{eqnarray}
  Z(\beta)
  &=\sum_{\sigma\in\Sigma_0}n_\sigma\int_{\mathcal J_\sigma}ds\,e^{-\beta\mathcal S(s)} \\
  &=\sum_{\sigma\in\Sigma_0}(-1)^{k_\sigma}\int_{\mathcal J_\sigma}ds\,e^{-\beta\mathcal S(s)} \\
  &=\sum_{\sigma\in\Sigma_0}(-1)^{k_\sigma}\left(\frac{2\pi}{\beta}\right)^{N/2}(\det\partial\partial\mathcal S(s_\sigma))^{-N/2}e^{-\beta\mathcal S_(s_\sigma)} \\
  &=\sum_k(-1)^k\int d\epsilon\,\mathcal N_k(\epsilon)\left(\frac{2\pi}{\beta}\right)^{N/2}\exp\left\{-\beta N\epsilon-\frac N2\int_0^\infty d\lambda\,\rho(\lambda\mid\epsilon)\log\lambda\right\}
\end{eqnarray}

\section{The \textit{p}-spin spherical models}

The $p$-spin spherical models are statistical mechanics models defined by the
action $\mathcal S=-\beta H$ for the Hamiltonian
\begin{equation} \label{eq:p-spin.hamiltonian}
  H(x)=\sum_{p=2}^\infty\frac{a_p}{p!}\sum_{i_1\cdots i_p}^NJ_{i_1\cdots i_p}x_{i_1}\cdots x_{i_p}
\end{equation}
where the $x\in\mathbb R^N$ are constrained to lie on the sphere $x^2=N$.  The tensor
components $J$ are complex normally distributed with zero mean and variances
$\overline{|J|^2}=p!/2N^{p-1}$ and $\overline{J^2}=\kappa\overline{|J|^2}$, and
the numbers $a$ define the model. The pure real $p$-spin model has
$a_i=\delta_{ip}$ and $\kappa=1$.

The phase space manifold $\Omega=\{x\mid x^2=N, x\in\mathbb R^N\}$ has a
complex extension $\tilde\Omega=\{z\mid z^2=N, z\in\mathbb C^N\}$. The natural
extension of the hamiltonian \eref{eq:p-spin.hamiltonian} to this complex manifold is
holomorphic. The normal to this manifold at any point $z\in\tilde\Omega$ is
always in the direction $z$.  The projection operator onto the tangent space of
this manifold is given by
\begin{equation}
  P=I-\frac{zz^\dagger}{|z|^2},
\end{equation}
where indeed $Pz=z-z|z|^2/|z|^2=0$ and $Pz'=z'$ for any $z'$ orthogonal to $z$.

To find critical points, we use the method of Lagrange multipliers. Introducing $\mu\in\mathbb C$,

\subsection{2-spin}

The Hamiltonian of the $2$-spin model is defined for $z\in\mathbb C^N$ by
\begin{equation}
  H_0=\frac12z^TJz.
\end{equation}
$J$ is generically diagonalizable by a complex orthogonal matrix. In a diagonal basis, $J_{ij}=\lambda_i\delta_{ij}$. Then $\partial_i H=\lambda_iz_i$. We will henceforth assume to be working in this basis. To find the critical points, we use the method of Lagrange multipliers. Introducing $\epsilon$, the constrained Hamiltonian is
\begin{equation}
  H=H_0+\epsilon(N-z^2)
\end{equation}
As usual, $\epsilon$ is equivalent to the energy per spin at any critical point.
Critical points must satisfy
\begin{equation}
  0=\partial_iH=(\lambda_i-2\epsilon)z_i
\end{equation}
which is only possible for $z_i=0$ or $\epsilon=\frac12\lambda_i$. Generically the $\lambda_i$ will all differ, so this can only be satisfied for one $\lambda_i$ at a time, and to be a critical point all other $z_j$ must be zero. In the direction in question,
\begin{equation}
  \frac1N\frac12\lambda_iz_i^2=\epsilon=\frac12\lambda_i,
\end{equation}
whence $z_i=\pm\sqrt{N}$. Thus there are $2N$ critical points, each corresponding to $\pm$ the cardinal directions in the diagonalized basis.

Suppose that two critical points have the same imaginary energy; without loss
of generality, assume these are associated with the first and second
cardinal directions. Since the gradient is proportional to $z$, any components that are
zero at some time will be zero at all times. The dynamics for the components of
interest assuming all others are zero are
\begin{eqnarray}
  \dot z_1
  &=-z_1^*\left(d_1^*-\frac{d_1^*z_1^*z_1+d_2^*z_2^*z_2}{|z_1|^2+|z_2|^2}\right) \\
  &=-(d_1-d_2)^*z_1^*\frac{|z_2|^2}{|z_1|^2+|z_2|^2}
\end{eqnarray}
and the same for $z_2$ with all indices swapped.  Since $\Delta=d_1-d_2$ is
real, if $z_1$ begins real it remains real, with the same for $z_2$. Since the
critical points are at real $z$, we make this restriction, and find
\begin{equation}
  \frac d{dt}(z_1^2+z_2^2)=0 \qquad
  \frac d{dt}\frac{z_2}{z_1}=\Delta\frac{z_2}{z_1}
\end{equation}
Therefore $z_2/z_1=e^{\Delta t}$, with $z_1^2+z_2^2=N$ as necessary.  Depending
on the sign of $\Delta$, $z$ flows from one critical point to the other over
infinite time. This is a Stokes line, and establishes that any two critical
points in the 2-spin model with the same imaginary energy will possess one.
These trajectories are plotted in Fig.~\ref{fig:two-spin}.

\begin{figure}
  \begin{gnuplot}[terminal=epslatex, terminaloptions={size 8.65cm,5.35cm}]
    set xlabel '$\Delta t$'
    set ylabel '$z(t) / \sqrt{N}$'

    plot 1 / sqrt(1 + exp(2 * x)) t '$z_1$', \
         1 / sqrt(1 + exp(- 2 * x)) t '$z_2$'
  \end{gnuplot}
  \caption{
    The Stokes line in the 2-spin model when the critical points associated
    with the first and second cardinal directions are brought to the same
    imaginary energy. $\Delta$ is proportional to the difference between the
    real energies of the first and the second critical point; when $\Delta >0$
    flow is from first to second, while when $\Delta < 0$ it is reversed.
  } \label{fig:two-spin}
\end{figure}

Since they sit at the corners of a simplex, the critical points of the 2-spin
model are all adjacent: no critical point is separated from another by the
separatrix of a third. This means that when the imaginary energies of two
critical points are brought to the same value, their surfaces of constant
imaginary energy join.

\begin{eqnarray}
  Z(\beta)
  &=\int_{S^{N-1}}dx\,e^{-\beta H(x)}
  =\int_{\mathbb R^N}dx\,\delta(x^2-N)e^{-\beta H(x)} \\
  &=\frac1{2\pi}\int_{\mathbb R^N}dx\,d\lambda\,e^{-\frac12\beta x^TJx-\lambda(x^Tx-N)} \\
  &=\frac1{2\pi}\int_{\mathbb R^N}dx\,d\lambda\,e^{-\frac12x^T(\beta J+\lambda I)x+\lambda N} \\
  &=\frac1{2\pi}\int d\lambda\,\sqrt{\frac{(2\pi)^N}{\det(\beta J+\lambda I)}}e^{\lambda N} \\
  &=\frac1{2\pi}\int d\lambda\,\sqrt{\frac{(2\pi)^N}{\prod_i(\beta\lambda_i+\lambda)}}e^{\lambda N} \\
  &=(2\pi)^{N/2-1}\int d\lambda\,e^{\lambda N-\frac12\sum_i\log(\beta\lambda_i+\lambda)} \\
  &\simeq(2\pi)^{N/2-1}\int d\lambda\,e^{\lambda N-\frac N2\int d\lambda'\,\rho(\lambda')\log(\beta\lambda'+\lambda)} \\
\end{eqnarray}

\subsection{Pure \textit{p}-spin}

\begin{equation}
  H_p=\frac1{p!}\sum_{i_1\cdots i_p}J_{i_1\cdots i_p}z_{i_1}\cdots z_{i_p}
\end{equation}

\begin{figure}
  \begin{gnuplot}[terminal=epslatex, terminaloptions={size 8.65cm,5.35cm}]
    set parametric
    set hidden3d
    set isosamples 100,25
    set samples 100,100
    unset key
    set dummy u,r
    set urange [-pi:pi]
    set vrange [1:1.5]
    set cbrange [0:2]
    set xyplane 0

    set xlabel '$\operatorname{Re}\epsilon$'
    set ylabel '$\operatorname{Im}\epsilon$'
    set zlabel '$r$'
    set cblabel '$\frac\epsilon{\epsilon_{\mathrm{th}}}$'

    p = 4
    set palette defined (0 "blue", 0.99 "blue", 1.0 "white", 1.01 "red", 2 "red")
    set pm3d depthorder border linewidth 0.5

    s(r) = sqrt(0.75 * log(9 * r**4 / (1 + r**2 + r**4)) / (8 * r**4 - r**2 - 1))
    x(u, r) = cos(u) * s(r) * sqrt(1 + 5 * r**2 + 5 * r**4 + r**6)
    y(u, r) = sin(u) * s(r) * sqrt((r**2 - 1)**3)
    thres(u, r) = ((x(u,r) / (r**(p - 2) + 1))**2 + (y(u,r) / (r**(p - 2) - 1))**2) / ((p - 1) / (2 * p * r**(p - 2)))

    splot "++" using (x(u, r)):(y(u, r)):2:(thres(u, r)) with pm3d lc palette
  \end{gnuplot}
  \caption{
    The surface of extant states for the 4-spin model, that is, those for which
    the complexity is zero.
  }
\end{figure}

\subsection{(2 + 4)-spin}

\begin{equation}
  H_2+H_4
\end{equation}

\section{Numerics}

To confirm the presence of Stokes lines under certain processes in the $p$-spin, we studied the problem numerically.


\bibliographystyle{unsrt}
\bibliography{stokes}

\appendix

\section{Geometry}

The surface $M\subset\mathbb C^N$ defined by $N=f(z)=z^2$ is an $N-1$ dimensional
\emph{Stein manifold}, a type of complex manifold defined by the level set of a
holomorphic function \cite{Forstneric_2017_Stein}. One can define a Hermitian
metric $h$ on $M$ by taking the restriction of the standard metric of $\mathbb
C^N$ to vectors tangent along $M$. For any smooth function $\phi:M\to\mathbb
R$, its gradient is a holomorphic vector field given by
\begin{equation}
  \operatorname{grad}\phi=\bar\partial^\sharp\phi
\end{equation}
Suppose $u:M\to\mathbb C^{N-1}$ is a coordinate system. Then
\begin{equation}
  \operatorname{grad}\phi=h^{\bar\beta\alpha}\bar\partial_{\bar\beta}\phi\frac{\partial}{\partial u^\alpha}
\end{equation}
Let $z=u^{-1}$.
\begin{equation}
  \frac\partial{\partial u^\alpha}=\frac{\partial z^i}{\partial u^\alpha}\frac\partial{\partial z^i}
\end{equation}
\begin{equation}
  \bar\partial_{\bar\beta}\phi=\frac{\partial\bar z^i}{\partial\bar u^{\bar\beta}}\frac{\partial\phi}{\partial\bar z^i}
\end{equation}
\begin{equation}
  \operatorname{grad}\phi
  =\frac{\partial\bar z^{\bar\jmath}}{\partial\bar u^{\bar\beta}}h^{\bar\beta\alpha}\frac{\partial z^i}{\partial u^\alpha}\frac{\partial\phi}{\partial\bar z^{\bar\jmath}}\frac\partial{\partial z^i}
\end{equation}
At any point $z_0\in M$, $z_0$ is parallel to the normal to $M$. Without loss of generality, take $z_0=e^N$. In a neighborhood of $z_0$, the map $u^\alpha=z^\alpha$ is a coordinate system.
its inverse is $z^i=u^i$ for $1\leq i\leq N-1$ and
\begin{equation}
  z^N=\sqrt{N-u^2}.
\end{equation}
The Jacobian is
\begin{equation}
  \frac{\partial z^i}{\partial u^\alpha}=\delta^i_\alpha-\delta_N^{i}\frac{u^\alpha}{\sqrt{N-u^2}}
\end{equation}
and therefore the Hermitian metric induced by the map is
\begin{equation}
  h_{\alpha\bar\beta}=\frac{\partial\bar z^i}{\partial\bar u^\alpha}\frac{\partial z^{\bar\jmath}}{\partial u^{\bar\beta}}\delta_{i\bar\jmath}
  =\delta_{\alpha\bar\beta}+\frac{\bar u^{\alpha}u^{\bar\beta}}{|N-u^2|}
\end{equation}
The metric can be inverted explicitly:
\begin{equation}
  h^{\bar\beta\alpha}
  =\delta^{\bar\beta\alpha}-\frac{\bar u^{\bar\beta}u^\alpha}{|N-u^2|+|u|^2}.
\end{equation}
Putting these pieces together, we find
\begin{equation}
  \frac{\partial\bar z^{\bar\jmath}}{\partial\bar u^{\bar\beta}}h^{\bar\beta\alpha}\frac{\partial z^i}{\partial u^\alpha}
  =\delta^{\bar\jmath i}-\frac{z^{\bar\jmath}\bar z^i}{|z|^2}
\end{equation}
\begin{equation}
  \operatorname{grad}\phi
  =\left(\delta^{\bar\jmath i}-\frac{z^{\bar\jmath}\bar z^i}{|z|^2}\right)
  \frac{\partial\phi}{\partial\bar z^{\bar\jmath}}\frac\partial{\partial z^i}
\end{equation}

\section{Numerics}

To study Stokes lines numerically, we approximated them by parametric curves.
If $z_0$ and $z_1$ are two stationary points of the action with
$\operatorname{Re}\mathcal S(z_0)>\operatorname{Re}\mathcal S(z_1)$, then we
take the curve
\begin{equation}
  z(t)
  =(1-t)z_0+tz_1+(1-t)t\sum_{i=0}^mg_it^i
\end{equation}
where the $g$s are undetermined complex vectors. These are fixed by minimizing
a cost function, which has a global minimum only for Stokes lines. Defining
\begin{equation}
  \mathcal L(t)
  = 1-\frac{\operatorname{Re}[\dot z^*(z(t))\cdot z'(t)]}{|\dot z(z(t))||z'(t)|}
\end{equation}
this cost is given by
\begin{equation}
  \mathcal C=\int_0^1 dt\,\mathcal L(t)
\end{equation}
$\mathcal C$ has minimum of zero, which is reached only by functions $z(t)$
whose tangent is everywhere parallel to the direction $\dot z$ of the dynamics.
Therefore, functions that minimize $\mathcal C$ are time-reparameterized Stokes
lines.

We explicitly computed the gradient and Hessian of $\mathcal C$ with respect to
the parameter vectors $g$. Stokes lines are found or not between points by
using the Levenberg--Marquardt algorithm starting from $g^{(i)}=0$ for all $i$,
and approximating the cost integral by a finite sum.

\end{document}
