states.w_state

Generalized w-state is an entangled quantum state of n qubits.

This state refers to the quantum superposition in which one of the qubits is in an excited state and others are in the ground state.

Functions

w_state(num_qubits[, coeff])

Produce a W-state [1].

Module Contents

states.w_state.w_state(num_qubits, coeff=None)

Produce a W-state [1].

Returns the W-state described in [1]. The W-state on num_qubits qubits is defined by:

\[|W \rangle = \frac{1}{\sqrt{num\_qubits}} \left(|100 \ldots 0 \rangle + |010 \ldots 0 \rangle + \ldots + |000 \ldots 1 \rangle \right).\]

Examples

Using toqito, we can generate the \(3\)-qubit W-state

\[|W_3 \rangle = \frac{1}{\sqrt{3}} \left( |100\rangle + |010 \rangle + |001 \rangle \right)\]

as follows.

>>> from toqito.states import w_state
>>> w_state(3)
array([[0.    ],
       [0.5774],
       [0.5774],
       [0.    ],
       [0.5774],
       [0.    ],
       [0.    ],
       [0.    ]])

We may also generate a generalized \(W\)-state. For instance, here is a \(4\)-dimensional \(W\)-state

\[\frac{1}{\sqrt{30}} \left( |1000 \rangle + 2|0100 \rangle + 3|0010 \rangle + 4 |0001 \rangle \right).\]

We can generate this state in toqito as

>>> from toqito.states import w_state
>>> import numpy as np
>>> coeffs = np.array([1, 2, 3, 4]) / np.sqrt(30)
>>> w_state(4, coeffs)
array([[0.    ],
       [0.7303],
       [0.5477],
       [0.    ],
       [0.3651],
       [0.    ],
       [0.    ],
       [0.    ],
       [0.1826],
       [0.    ],
       [0.    ],
       [0.    ],
       [0.    ],
       [0.    ],
       [0.    ],
       [0.    ]])

References

[1] (1,2,3)

W. Dür, G. Vidal, and J. I. Cirac. Three qubits can be entangled in two inequivalent ways. Physical Review A, Nov 2000. URL: http://dx.doi.org/10.1103/PhysRevA.62.062314, doi:10.1103/physreva.62.062314.

Raises:

ValueError – The number of qubits must be greater than or equal to 1.

Parameters:
  • num_qubits (int) – An integer representing the number of qubits.

  • coeff (list[int]) – default is [1, 1, …, 1]/sqrt(num_qubits): a 1-by-num_qubts vector of coefficients.

Return type:

numpy.ndarray