Suppose we start with $|00...0\rangle$. We want to build an equal superposition over $|0\rangle + ... + |n-1\rangle$.

When $n=2^m$ for some $m$, I know I can do this using $H^{\otimes m}$.

What is the general circuit for this (i.e. in case $n$ is not power of 2)?


You can use a single step of amplitude amplification, with a less-than-N oracle, to get to a uniform distribution.

Example Quirk Circuit

enter image description here

Source: https://arxiv.org/abs/1805.03662


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.