  We present a spectrally-accurate scheme to turn a boundary integral
formulation for an elliptic PDE on a single unit cell geometry into one for the
fully periodic problem. Applications include computing the effective
permeability of composite media (homogenization), and microfluidic chip design.
Our basic idea is to exploit a small least squares solve to apply periodicity
without ever handling periodic Green's functions. We exhibit fast solvers for
the two-dimensional (2D) doubly-periodic Neumann Laplace problem (flow around
insulators), and Stokes non-slip fluid flow problem, that for inclusions with
smooth boundaries achieve 12-digit accuracy, and can handle thousands of
inclusions per unit cell. We split the infinite sum over the lattice of images
into a directly-summed "near" part plus a small number of auxiliary sources
which represent the (smooth) remaining "far" contribution. Applying physical
boundary conditions on the unit cell walls gives an expanded linear system,
which, after a rank-1 or rank-3 correction and a Schur complement, leaves a
well-conditioned square system which can be solved iteratively using fast
multipole acceleration plus a low-rank term. We are rather explicit about the
consistency and nullspaces of both the continuous and discretized problems. The
scheme is simple (no lattice sums, Ewald methods, nor particle meshes are
required), allows adaptivity, and is essentially dimension- and
PDE-independent, so would generalize without fuss to 3D and to other
non-oscillatory elliptic problems such as elastostatics. We incorporate
recently developed spectral quadratures that accurately handle
close-to-touching geometries. We include many numerical examples, and provide a
software implementation.
