DickeState

DickeState is a function that returns a Dicke state on a given number of qubits. For example, the usual $3$-qubit Dicke state is:
 * $$\frac{1}{\sqrt{3}}(|001\rangle + |010\rangle + |100\rangle).$$

More generally, the Dicke state on $N$ qubits with $k$ excitations is
 * $$\frac{1}{\sqrt{\binom{N}{k}}}\sum_{j} P_j \big(|0\rangle^{\otimes (N-k)} \otimes|1\rangle^{\otimes k} \big),$$

where $P_j$ ranges over all operators that permute the $N$ qubits in the $\binom{N}{k}$ possible distinct ways. The output of this function is a sparse vector.

Syntax

 * DICKE_STATE = DickeState(N)
 * DICKE_STATE = DickeState(N,K)
 * DICKE_STATE = DickeState(N,K,NRML)

Argument descriptions

 * N: The number of qubits.
 * K (optional, default 1): The number of excitations (i.e., the number of "1" qubits in each term of the superposition; must be between 0 and N, inclusive.
 * NRML</tt> (optional, default 1): A flag (either 1 or 0) indicating that DICKE_STATE</tt> should or should not be scaled to have Euclidean norm 1. If NRML=0</tt> then each entry of DICKE_STATE</tt> is 0 or 1, so it has norm $\sqrt{\binom{N}{k}}$.

3-qubit Dicke state
The following code generates the 3-qubit Dicke state (with 1 excitation):

A 5-qubit Dicke state
The following code generates the 5-qubit 2-excitation Dicke state
 * $$\frac{1}{\sqrt{10}}\big( |00011\rangle + |00101\rangle + |00110\rangle + |01001\rangle + |01010\rangle + |01100\rangle + |10001\rangle + |10010\rangle + |10100\rangle + |11000\rangle \big).$$

A very large Dicke state
This script has no trouble creating Dicke states on very large numbers of qubits. The following code generates a 45-qubit Dicke state:

Note that Octave has a size limit of 2^31-1, so DickeState(30)</tt> is the limit of this function there. DickeState(31)</tt> and larger will produce an error in Octave (but not MATLAB).