We use the Maslov index to study the spectrum of a class of linear
Hamiltonian differential operators. We provide a lower bound on the number of
positive real eigenvalues, which includes a contribution to the Maslov index
from a non-regular crossing. A close study of the eigenvalue curves, which
represent the evolution of the eigenvalues as the domain is shrunk or expanded,
yields formulas for their concavity at the non-regular crossing in terms of the
corresponding Jordan chains. This, along with homotopy techniques, enables the
computation of the Maslov index at such a crossing. We apply our theory to
study the spectral (in)stability of standing waves in the nonlinear
Schr\"odinger equation on a compact spatial interval. We derive new stability
results in the spirit of the Jones--Grillakis instability theorem and the
Vakhitov--Kolokolov criterion, both originally formulated on the real line. A
fundamental difference upon passing from the real line to the compact interval
is the loss of translational invariance, in which case the zero eigenvalue of
the linearised operator is geometrically simple. Consequently, the stability
results differ depending on the boundary conditions satisfied by the wave. We
compare our lower bound to existing results involving constrained eigenvalue
counts, finding a direct relationship between the correction factors found
therein and the objects of our analysis, including the second-order Maslov
crossing form.Comment: 48 pages, 8 figure