  We propose and analyze the design of a programmable photonic integrated
circuit for high-fidelity quantum computation and simulation. We demonstrate
that the reconfigurability of our design allows us to overcome two major
impediments to quantum optics on a chip: it removes the need for a full
fabrication cycle for each experiment and allows for compensation of
fabrication errors using numerical optimization techniques. Under a pessimistic
fabrication model for the silicon-on-insulator process, we demonstrate a
dramatic fidelity improvement for the linear optics CNOT and CPHASE gates and,
showing the scalability of this approach, the iterative phase estimation
algorithm built from individually optimized gates. We also propose and simulate
a novel experiment that the programmability of our system would enable: a
statistically robust study of the evolution of entangled photons in disordered
quantum walks. Overall, our results suggest that existing fabrication processes
are sufficient to build a quantum photonic processor capable of high fidelity
operation.
