$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ I'm looking for (unitary$^1$) transformations$^2$, to create a superposition of any $n$ computational basis states with equal coefficients. I'm further interested in the complexity of these implementations and/or a gate count.
Building up on this question, on how to create superpositions of 3 states, I wonder how it scales to split up into any number of $n$ computational basis states. For simplicity let's always start with $\ket{00...0}$. Here are my thoughts:
- $n=5$: Split $\ket{000}\rightarrow \sqrt\frac25\ket{000}+ \sqrt\frac35\ket{001}$ by a local $Y$-gate , then implement a controlled (trigger when the rightmost bit is $0$) split like $\ket{000}\rightarrow \sqrt{\frac12}(\ket{000}+\ket{010})$ and finally a controlled (trigger when the leftmost bit is $1$) split like $\ket{001}\rightarrow \sqrt{\frac13}(\ket{001}+\ket{011}+\ket{111})$. For reference see here.
- $n=6$: same as for $n=5$ but after an local split into 2 equal halves on the first (rightmost/top) qubit, 2 controlled splits into 3 states are involved.
- $n=7$: again split in two parts with the weigths $\sqrt\frac37 :\sqrt\frac47$ and further implement controlled splits...
- $n=8$: trivial
- $n=9$: this takes 4 qubits. Split into 3 on the first 2 qubits and then have controlled splits into another 3 on the last 2 qubits.
I haven't counted CNOTs and local operations (necessary for answering the scaling question), but the pattern looks like something, how to decompose numbers. Is there a generic way to come up with a circuit to split into $n$ computational basis states?
If you can improve my suggested implementations, let me know...