  We describe a quantum algorithm that generalizes the quantum linear system
algorithm [Harrow et al., Phys. Rev. Lett. 103, 150502 (2009)] to arbitrary
problem specifications. We develop a state preparation routine that can
initialize generic states, show how simple ancilla measurements can be used to
calculate many quantities of interest, and integrate a quantum-compatible
preconditioner that greatly expands the number of problems that can achieve
exponential speedup over classical linear systems solvers. To demonstrate the
algorithm's applicability, we show how it can be used to compute the
electromagnetic scattering cross section of an arbitrary target exponentially
faster than the best classical algorithm.
