  We develop a fast method for computing the electrostatic energy and forces
for a collection of charges in doubly-periodic slabs with jumps in the
dielectric permittivity at the slab boundaries. Our method achieves spectral
accuracy by using Ewald splitting to replace the original Poisson equation for
nearly-singular sources with a smooth far-field Poisson equation, combined with
a localized near-field correction. Unlike existing spectral Ewald methods,
which make use of the Fourier transform in the aperiodic direction, we recast
the problem as a two-point boundary value problem in the aperiodic direction
for each transverse Fourier mode, for which exact analytic boundary conditions
are available. We solve each of these boundary value problems using a fast,
well-conditioned Chebyshev method. In the presence of dielectric jumps,
combining Ewald splitting with the classical method of images results in
smoothed charge distributions which overlap the dielectric boundaries
themselves. We show how to preserve spectral accuracy in this case through the
use of a harmonic correction which involves solving a simple Laplace equation
with smooth boundary data. We implement our method on Graphical Processing
Units, and combine our doubly-periodic Poisson solver with Brownian Dynamics to
study the equilibrium structure of double layers in binary electrolytes
confined by dielectric boundaries. Consistent with prior studies, we find
strong charge depletion near the interfaces due to repulsive interactions with
image charges, which points to the need for incorporating polarization effects
in understanding confined electrolytes, both theoretically and computationally.
