Bell

Bell is a function that returns one of the four Bell states in 2-qubit space: $$\displaystyle\begin{align*}|\phi_0\rangle = \frac{1}{\sqrt{2}}(|0\rangle\otimes|0\rangle + |1\rangle\otimes|1\rangle) & & & & |\phi_2\rangle = \frac{1}{\sqrt{2}}(|0\rangle\otimes|1\rangle + |1\rangle\otimes|0\rangle) \\ |\phi_1\rangle = \frac{1}{\sqrt{2}}(|0\rangle\otimes|0\rangle - |1\rangle\otimes|1\rangle) & & & & |\phi_3\rangle = \frac{1}{\sqrt{2}}(|0\rangle\otimes|1\rangle - |1\rangle\otimes|0\rangle) \\\end{align*}$$

Syntax

 * PHI = Bell
 * PHI = Bell(IND)
 * PHI = Bell(IND,SP)
 * PHI = Bell(IND,SP,NRML)

Argument descriptions

 * IND (optional, default 0): The index of the Bell state (i.e., the subscript, from 0 to 3, of the Bell state that you would like, as indicated above).
 * SP (optional, default 0): A flag (either 1 or 0) indicating that PHI should or should not be sparse.
 * NRML</tt> (optional, default 1): A flag (either 1 or 0) indicating that PHI</tt> should or should not be scaled to have Euclidean norm 1. If NRML=0</tt> then each entry of PHI</tt> is 0 or 1, so it has norm $\sqrt{2}$.

Examples
The following code generates a matrix whose columns are the four different Bell states: