Difference between revisions of "GHZState"

From QETLAB
Jump to navigation Jump to search
(Created page with "{{Function |name=GHZState |desc=Generates a (generalized) GHZ state |rel=DickeState<br />MaxEntangled<br />WState |cat=List of functions#Special_states,_vectors,...")
 
m (Added link to Wikipedia)
 
Line 5: Line 5:
 
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]]
 
|cat=[[List of functions#Special_states,_vectors,_and_operators|Special states, vectors, and operators]]
 
|upd=December 15, 2014}}
 
|upd=December 15, 2014}}
<tt>'''GHZState'''</tt> is a [[List of functions|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.
+
<tt>'''GHZState'''</tt> is a [[List of functions|function]] that returns a [http://en.wikipedia.org/wiki/Greenberger%E2%80%93Horne%E2%80%93Zeilinger_state 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==
 
==Syntax==

Latest revision as of 04:07, 20 December 2014

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.7071

A 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.7303

A 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.5774

Source code

Click here to view this function's source code on github.