I would like to build a circuit that takes multiple qubit system states and puts them in a superposition with equal amplitudes.
For example: Let's consider a 4 qubit system. I would like the circuit to start with an input of $\left| 0000 \right>$ and end with the following superposition: $$\frac{1}{\sqrt{4}}\left(\left| 1000 \right> + \left| 1010 \right> + \left| 1001 \right> + \left| 1100 \right>\right).$$
I would like for the choice of states and number of states to be arbitrary. I.e. that I can easily perform the same circuit to generate
$$\frac{1}{\sqrt{3}}\left(\left| 1000 \right> + \left| 1011 \right> + \left| 1101 \right>\right),$$
or
$$\frac{1}{\sqrt{5}}\left(\left| 1000 \right> + \left| 1010 \right> + \left| 1001 \right> + \left| 1100 \right> + \left| 1111 \right>\right).$$
Can anyone help me with this? Any help is appreciated!
EDIT: I have tried creating a matrix representation of such an operator, and I have found one that does what I need it to do, it maps the $\left|00\right>$ to an arbitrary equally-distributed superposition of the basis vectors of my choosing. Here is the matrix I found that acts on 2 qubits to create such a state:
$$ U = \begin{pmatrix} 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{pmatrix}. $$
This gives:
$$ U\left|00\right>= \begin{pmatrix} 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 1/\sqrt{3} & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ \end{pmatrix} \begin{pmatrix} 1\\ 0\\ 0\\ 0 \end{pmatrix} = \frac{1}{\sqrt{3}} \begin{pmatrix} 1\\ 1\\ 1\\ 0 \end{pmatrix} = \frac{1}{\sqrt{3}}\left( \left|00\right> + \left|01\right> + \left|10\right> \right). $$
The idea is that the first column of the matrix would consist of $N$ non-zero elements, each element contrbuting one basis state to the final superposition, and each element being equal to $\frac{1}{\sqrt{N}}$.
The problem with this matrix, however, is that it is not unitary. Would it be possible to modify this matrix in such a wat that it still has the same result on the $|00>$ state vector, but that it is unitary? This would solve my problem completely.