GHZState
| GHZState | |
| Generates a (generalized) GHZ state | |
| Other toolboxes required | none |
|---|---|
| Related functions | DickeState MaxEntangled WState |
| Function category | Special states, vectors, and operators |
GHZState is a function that returns a GHZ state on a given number of qubits (or qudits). For example, the usual $3$-qubit GHZ state is $\frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$. More generally, the GHZ state on $q$ qudits with local dimension $d$ is $\frac{1}{\sqrt{d}}\sum_{j=0}^{d-1} |j\rangle^{\otimes q}$. The output of this function is a sparse vector.
Syntax
- GHZ_STATE = GHZState(DIM,Q)
- GHZ_STATE = GHZState(DIM,Q,COEFF)
Argument descriptions
- DIM: The local dimension.
- Q: The number of qubits (or qudits, if DIM > 2).
- COEFF (optional, default [1,1,...,1]/sqrt(DIM)): A vector whose $j$-th entry is the coefficient of the term $|j-1\rangle^{\otimes q}$ in the generalized GHZ state.
Examples
3-qubit GHZ state
The following code generates the usual 3-qubit GHZ state:
>> full(GHZState(2,3))
ans =
0.7071
0
0
0
0
0
0
0.7071A 7-qudit GHZ state
The following code generates the following GHZ state living in $(\mathbb{C}^4)^{\otimes 7}$: \[\frac{1}{\sqrt{30}}\big( |0000000\rangle + 2|1111111\rangle + 3|2222222\rangle + 4|3333333\rangle \big).\]
>> GHZState(4,7,[1,2,3,4]/sqrt(30))
ans =
(1,1) 0.1826
(5462,1) 0.3651
(10923,1) 0.5477
(16384,1) 0.7303A very large GHZ state
This script has no trouble creating GHZ states on very large numbers of qudits. The following code generates the GHZ state in $(\mathbb{C}^3)^{\otimes 30}$:
>> GHZState(3,30)
ans =
(1,1) 0.5774
(102945566047325,1) 0.5774
(205891132094649,1) 0.5774Source code
Click here to view this function's source code on github.