  We present a quantum synthesis algorithm designed to produce short circuits
and to scale well in practice. The main contribution is a novel representation
of circuits able to encode placement and topology using generic "gates", which
allows the QFAST algorithm to replace expensive searches over circuit
structures with few steps of numerical optimization. When compared against
optimal depth, search based state-of-the-art techniques, QFAST produces
comparable results: 1.19x longer circuits up to four qubits, with an increase
in compilation speed of 3.6x. In addition, QFAST scales up to seven qubits.
When compared with the state-of-the-art "rule" based decomposition techniques
in Qiskit, QFAST produces circuits shorter by up to two orders of magnitude
(331x), albeit 5.6x slower. We also demonstrate the composability with other
techniques and the tunability of our formulation in terms of circuit depth and
running time.
