weylchamber.gates module

Quantum gates required for Weyl chamber calculations

Module data:

weylchamber.gates.Qmagic

Transformation matrix to the “magic” Bell basis:

\[\begin{split}\Op{Q} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 & 0 & i \\ 0 & i & 1 & 0 \\ 0 & i & -1 & 0 \\ 1 & 0 & 0 & -i \end{pmatrix}\end{split}\]

See “Theorem 1” in Y. Makhlin, Quantum Inf. Process. 1, 243 (2002)

weylchamber.gates.SxSx

\(\Op{\sigma}_x \otimes \Op{\sigma}_x\) gate

weylchamber.gates.SySy

\(\Op{\sigma}_y \otimes \Op{\sigma}_y\) gate

weylchamber.gates.SzSz

\(\Op{\sigma}_z \otimes \Op{\sigma}_z\) gate

Summary

Functions:

bell_basis

Two-qubit Bell basis associated with the given canonical basis

gate

Two-qubit gate that maps basis to states

mapped_basis

Result of applying gate to basis

__all__: Qmagic, SxSx, SySy, SzSz, bell_basis, gate, mapped_basis

Reference

weylchamber.gates.bell_basis(canonical_basis)[source]

Two-qubit Bell basis associated with the given canonical basis

Example

>>> from qutip import ket
>>> canonical_basis = [
...     ket(nums) for nums in [(0, 0), (0, 1), (1, 0), (1, 1)]
... ]
>>> bell = bell_basis(canonical_basis)
>>> _bell = [
...     (     ket((0, 0)) +      ket((1, 1))) / np.sqrt(2),
...     (1j * ket((0, 1)) + 1j * ket((1, 0))) / np.sqrt(2),
...     (     ket((0, 1)) -      ket((1, 0))) / np.sqrt(2),
...     (1j * ket((0, 0)) - 1j * ket((1, 1))) / np.sqrt(2),
... ]
>>> assert (bell[0] - _bell[0]).norm() < 1e-15
>>> assert (bell[1] - _bell[1]).norm() < 1e-15
>>> for (a, b) in zip(bell, _bell):
...     assert (a - b).norm() < 1e-15, (a - b).norm()
weylchamber.gates.gate(basis, states)[source]

Two-qubit gate that maps basis to states

Example

>>> from qutip import ket
>>> basis = [ket(nums) for nums in [(0, 0), (0, 1), (1, 0), (1, 1)]]
>>> states = mapped_basis(qutip.core.gates.cnot(), basis)
>>> U = gate(basis, states)
>>> assert (U - qutip.core.gates.cnot()).norm() < 1e-15
weylchamber.gates.mapped_basis(gate, basis)[source]

Result of applying gate to basis

Example

>>> from qutip import ket
>>> basis = [ket(nums) for nums in [(0, 0), (0, 1), (1, 0), (1, 1)]]
>>> states = mapped_basis(qutip.core.gates.cnot(), basis)
>>> assert (states[0] - ket((0,0))).norm() < 1e-15
>>> assert (states[1] - ket((0,1))).norm() < 1e-15
>>> assert (states[2] - ket((1,1))).norm() < 1e-15  # swap (1, 1) ...
>>> assert (states[3] - ket((1,0))).norm() < 1e-15  # ... and (1, 0)