  In this paper we present a rigorous modulational stability theory for
periodic traveling wave solutions to equations of nonlinear Schr\"odinger (NLS)
type. We first argue that, for Hamiltonian dispersive equations with a
non-singular symplectic form and $d$ conserved quantities (in addition to the
Hamiltonian), one expects that generically ${\mathcal L}$, the linearization
around a periodic traveling wave, will have a $2d$ dimensional generalized
kernel, with a particular Jordan structure: The kernel of ${\mathcal L}$ is
expected to be $d$ dimensional, the first generalized kernel is expected to be
$d$ dimensional, and there are expected to be no higher generalized kernels.
The breakup of this $2d$ dimensional kernel under perturbations arising from a
change in boundary conditions dictates the modulational stability or
instability of the underlying periodic traveling wave.
  This general picture is worked out in detail for the case of equations of NLS
type. We give explicit genericity conditions that guarantee that the Jordan
form is the generic one: these take the form of non-vanishing determinants of
certain matrices whose entries can be expressed in terms of a finite number of
moments of the traveling wave solution. Assuming that these genericity
conditions are met we give a normal form for the small eigenvalues that result
from the break-up of the generalized kernel, in the form of the eigenvalues of
a quadratic matrix pencil. We compare these results to direct numerical
simulation in a number of cases of interest: the cubic and quintic NLS
equations, for focusing and defocusing nonlinearities, subject to both
longitudinal and transverse perturbations. The longitudinal stability of
traveling waves of the cubic NLS has been previously studied using the
integrability: in this case our results agree with those in the literature. All
of the remaining cases appear to be new.
