qutip_qip.operations

Operations on quantum circuits.

Classes

Gate([name, targets, controls, arg_value, ...])

Base class for a quantum gate, concrete gate classes need to be defined as subclasses.

Measurement(name[, targets, index, ...])

Representation of a quantum measurement, with its required parameters, and target qubits.

GATE_CLASS_MAP

X(targets, **kwargs)

Single-qubit X gate.

Y(targets, **kwargs)

Single-qubit Y gate.

Z(targets, **kwargs)

Single-qubit Z gate.

RX(targets, arg_value, **kwargs)

Single-qubit rotation RX.

RY(targets, arg_value, **kwargs)

Single-qubit rotation RY.

RZ(targets, arg_value, **kwargs)

Single-qubit rotation RZ.

H(targets, **kwargs)

Hadamard gate.

SNOT

alias of H

SQRTNOT(targets, **kwargs)

\(\sqrt{X}\) gate.

S(targets, **kwargs)

S gate or \(\sqrt{Z}\) gate.

T(targets, **kwargs)

T gate or \(\sqrt[4]{Z}\) gate.

QASMU(targets[, arg_value])

QASMU gate.

SWAP(targets, **kwargs)

SWAP gate.

ISWAP(targets, **kwargs)

iSWAP gate.

CNOT(controls, targets, **kwargs)

CNOT gate.

SQRTSWAP(targets, **kwargs)

\(\sqrt{\mathrm{SWAP}}\) gate.

SQRTISWAP(targets, **kwargs)

\(\sqrt{\mathrm{iSWAP}}\) gate.

BERKELEY(targets, **kwargs)

BERKELEY gate.

SWAPALPHA(targets, arg_value, **kwargs)

SWAPALPHA gate.

MS(targets, arg_value, **kwargs)

Mølmer–Sørensen gate.

TOFFOLI(targets, **kwargs)

TOFFOLI gate.

FREDKIN(targets, **kwargs)

FREDKIN gate.

CNOT(controls, targets, **kwargs)

CNOT gate.

CSIGN(controls, targets, **kwargs)

Controlled CSIGN gate.

CRX

Controlled X rotation.

CRY

Controlled Y rotation.

CRZ

Controlled Z rotation.

CY

Controlled Y gate.

CX

Controlled X gate.

CZ(controls, targets, **kwargs)

Controlled Z gate.

CS

Controlled S gate.

CT

Controlled T gate.

CPHASE(controls, targets, arg_value[, ...])

CPHASE gate.

Functions

berkeley([N, targets])

Quantum object representing the Berkeley gate.

cnot([N, control, target])

Quantum object representing the CNOT gate.

controlled_gate(U[, controls, targets, N, ...])

Create an N-qubit controlled gate from a single-qubit gate U with the given control and target qubits.

cphase(theta[, N, control, target])

Returns quantum object representing the controlled phase shift gate.

cs_gate([N, control, target])

Controlled S gate.

csign([N, control, target])

Quantum object representing the CSIGN gate.

ct_gate([N, control, target])

Controlled T gate.

cy_gate([N, control, target])

Controlled Y gate.

cz_gate([N, control, target])

Controlled Z gate.

expand_operator(oper[, N, targets, dims, ...])

Expand an operator to one that acts on a system with desired dimensions.

fredkin([N, control, targets])

Quantum object representing the Fredkin gate.

gate_sequence_product(U_list[, ...])

Calculate the overall unitary matrix for a given list of unitary operations.

globalphase(theta[, N])

Returns quantum object representing the global phase shift gate.

hadamard_transform([N])

Quantum object representing the N-qubit Hadamard gate.

iswap([N, targets])

Quantum object representing the iSWAP gate.

molmer_sorensen(theta[, phi, N, targets])

Quantum object of a Mølmer–Sørensen gate.

phasegate(theta[, N, target])

Returns quantum object representing the phase shift gate.

qasmu_gate(args[, N, target])

QASM U-gate as defined in the OpenQASM standard.

qrot(theta, phi[, N, target])

Single qubit rotation driving by Rabi oscillation with 0 detune.

qubit_clifford_group([N, target])

Generates the Clifford group on a single qubit, using the presentation of the group given by Ross and Selinger (http://www.mathstat.dal.ca/~selinger/newsynth/).

rotation(op, phi[, N, target])

Single-qubit rotation for operator op with angle phi.

rx(phi[, N, target])

Single-qubit rotation for operator sigmax with angle phi.

ry(phi[, N, target])

Single-qubit rotation for operator sigmay with angle phi.

rz(phi[, N, target])

Single-qubit rotation for operator sigmaz with angle phi.

s_gate([N, target])

Single-qubit rotation also called Phase gate or the Z90 gate.

snot([N, target])

Quantum object representing the SNOT (Hadamard) gate.

sqrtiswap([N, targets])

Quantum object representing the square root iSWAP gate.

sqrtnot([N, target])

Single-qubit square root NOT gate.

sqrtswap([N, targets])

Quantum object representing the square root SWAP gate.

swap([N, targets])

Quantum object representing the SWAP gate.

swapalpha(alpha[, N, targets])

Quantum object representing the SWAPalpha gate.

t_gate([N, target])

Single-qubit rotation related to the S gate by the relationship S=T*T.

toffoli([N, controls, target])

Quantum object representing the Toffoli gate.

x_gate([N, target])

Pauli-X gate or sigmax operator.

y_gate([N, target])

Pauli-Y gate or sigmay operator.

z_gate([N, target])

Pauli-Z gate or sigmaz operator.

class qutip_qip.operations.BERKELEY(targets, **kwargs)[source]

Bases: TwoQubitGate

BERKELEY gate.

\[\begin{split}\begin{pmatrix} \cos(\frac{\pi}{8}) & 0 & 0 & i\sin(\frac{\pi}{8}) \\ 0 & \cos(\frac{3\pi}{8}) & i\sin(\frac{3\pi}{8}) & 0 \\ 0 & i\sin(\frac{3\pi}{8}) & \cos(\frac{3\pi}{8}) & 0 \\ i\sin(\frac{\pi}{8}) & 0 & 0 & \cos(\frac{\pi}{8}) \end{pmatrix}\end{split}\]

Examples

>>> from qutip_qip.operations import BERKELEY
>>> BERKELEY([0, 1]).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[0.92388+0.j      0.     +0.j      0.     +0.j      0.     +0.38268j]
 [0.     +0.j      0.38268+0.j      0.     +0.92388j 0.     +0.j     ]
 [0.     +0.j      0.     +0.92388j 0.38268+0.j      0.     +0.j     ]
 [0.     +0.38268j 0.     +0.j      0.     +0.j      0.92388+0.j     ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.CNOT(controls, targets, **kwargs)[source]

Bases: _OneControlledGate

CNOT gate.

Examples

>>> from qutip_qip.operations import CNOT
>>> CNOT(0, 1).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0.]
 [0. 1. 0. 0.]
 [0. 0. 0. 1.]
 [0. 0. 1. 0.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.CPHASE(controls, targets, arg_value, control_value=1, **kwargs)[source]

Bases: _OneControlledGate

CPHASE gate.

\[\begin{split}\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{i\theta} \\ \end{pmatrix}\end{split}\]

Examples

>>> from qutip_qip.operations import CPHASE
>>> CPHASE(0, 1, np.pi/2).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1.+0.j 0.+0.j 0.+0.j 0.+0.j]
 [0.+0.j 1.+0.j 0.+0.j 0.+0.j]
 [0.+0.j 0.+0.j 1.+0.j 0.+0.j]
 [0.+0.j 0.+0.j 0.+0.j 0.+1.j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.CSIGN(controls, targets, **kwargs)[source]

Bases: _OneControlledGate

Controlled CSIGN gate. Identical to the CZ gate.

Examples

>>> from qutip_qip.operations import CSIGN
>>> CSIGN(0, 1).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True
Qobj data =
[[ 1.  0.  0.  0.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0. -1.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.CZ(controls, targets, **kwargs)[source]

Bases: _OneControlledGate

Controlled Z gate. Identical to the CSIGN gate.

Examples

>>> from qutip_qip.operations import CZ
>>> CSIGN(0, 1).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True
Qobj data =
[[ 1.  0.  0.  0.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0. -1.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.FREDKIN(targets, **kwargs)[source]

Bases: Gate

FREDKIN gate.

Examples

>>> from qutip_qip.operations import FREDKIN
>>> FREDKIN([0, 1, 2]).get_compact_qobj() 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8, 8), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 1. 0.]
 [0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.Gate(name=None, targets=None, controls=None, arg_value=None, control_value=None, classical_controls=None, classical_control_value: Optional[int] = None, arg_label=None, **kwargs)[source]

Bases: object

Base class for a quantum gate, concrete gate classes need to be defined as subclasses.

Parameters
targetslist or int

The target qubits fo the gate.

controlslist or int

The controlling qubits of the gate.

arg_valueobject

Argument value of the gate. It will be saved as an attributes and can be accessed when generating the :obj:qutip.Qobj.

classical_controlsint or list of int, optional

Indices of classical bits to control the unitary operator.

control_valueint, optional

The decimal value of controlling bits for executing the unitary operator on the target qubits. E.g. if the gate should be executed when the zero-th bit is 1, controll_value=1; If the gate should be executed when the two bits are 1 and 0, controll_value=2.

classical_control_valueint, optional

The decimal value of controlling classical bits for executing the unitary operator on the target qubits. E.g. if the gate should be executed when the zero-th bit is 1, controll_value=1; If the gate should be executed when the two bits are 1 and 0, controll_value=2. The default is 2**len(classical_controls)-1 (i.e. all classical controls are 1).

arg_labelstring

Label for the argument, it will be shown in the circuit plot, representing the argument value provided to the gate, e.g, if arg_label="\phi" the latex name for the gate in the circuit plot will be ``$U(\phi)$.

namestring, optional

The name of the gate. This is kept for backward compatibility to identify different gates. In most cases it is identical to the class name, but that is not guaranteed. It is recommended to use isinstance or issubclass to identify a gate rather than comparing the name string.

get_all_qubits()[source]

Return a list of all qubits that the gate operator acts on. The list concatenates the two lists representing the controls and the targets qubits while retains the order.

Returns
targets_listlist of int

A list of all qubits, including controls and targets.

get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

get_qobj(num_qubits=None, dims=None)[source]

Get the qutip.Qobj representation of the gate operator. The operator is expanded to the full Herbert space according to the controls and targets qubits defined for the gate.

Parameters
num_qubitsint, optional

The number of qubits. If not given, use the minimal number of qubits required by the target and control qubits.

dimslist, optional

A list representing the dimensions of each quantum system. If not given, it is assumed to be an all-qubit system.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.H(targets, **kwargs)[source]

Bases: SingleQubitGate

Hadamard gate.

Examples

>>> from qutip_qip.operations import H
>>> H(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[ 0.70711  0.70711]
 [ 0.70711 -0.70711]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.ISWAP(targets, **kwargs)[source]

Bases: TwoQubitGate

iSWAP gate.

Examples

>>> from qutip_qip.operations import ISWAP
>>> ISWAP([0, 1]).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1.+0.j 0.+0.j 0.+0.j 0.+0.j]
 [0.+0.j 0.+0.j 0.+1.j 0.+0.j]
 [0.+0.j 0.+1.j 0.+0.j 0.+0.j]
 [0.+0.j 0.+0.j 0.+0.j 1.+0.j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.MS(targets, arg_value, **kwargs)[source]

Bases: TwoQubitGate

Mølmer–Sørensen gate.

\[\begin{split}\begin{pmatrix} \cos(\frac{\theta}{2}) & 0 & 0 & -ie^{-i2\phi}\sin(\frac{\theta}{2}) \\ 0 & \cos(\frac{\theta}{2}) & -i\sin(\frac{\theta}{2}) & 0 \\ 0 & -i\sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) & 0 \\ -ie^{i2\phi}\sin(\frac{\theta}{2}) & 0 & 0 & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]

Examples

>>> from qutip_qip.operations import MS
>>> MS([0, 1], (np.pi/2, 0)).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[0.70711+0.j      0.     +0.j      0.     +0.j      0.     -0.70711j]
 [0.     +0.j      0.70711+0.j      0.     -0.70711j 0.     +0.j     ]
 [0.     +0.j      0.     -0.70711j 0.70711+0.j      0.     +0.j     ]
 [0.     -0.70711j 0.     +0.j      0.     +0.j      0.70711+0.j     ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.Measurement(name, targets=None, index=None, classical_store=None)[source]

Bases: object

Representation of a quantum measurement, with its required parameters, and target qubits.

Parameters
namestring

Measurement name.

targetslist or int

Gate targets.

classical_storeint

Result of the measurment is stored in this classical register of the circuit.

measurement_comp_basis(state)[source]

Measures a particular qubit (determined by the target) whose ket vector/ density matrix is specified in the computational basis and returns collapsed_states and probabilities (retains full dimension).

Parameters
stateket or oper

state to be measured on specified by ket vector or density matrix

Returns
collapsed_statesList of Qobjs

the collapsed state obtained after measuring the qubits and obtaining the qubit specified by the target in the state specified by the index.

probabilitiesList of floats

the probability of measuring a state in a the state specified by the index.

class qutip_qip.operations.QASMU(targets, arg_value=None, **kwargs)[source]

Bases: SingleQubitGate

QASMU gate.

\[U(\theta, \phi, \gamma) = RZ(\phi) RY(\theta) RZ(\gamma)\]

Examples

>>> from qutip_qip.operations import QASMU
>>> QASMU(0, (np.pi/2, np.pi, np.pi/2)).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[-0.5-0.5j -0.5+0.5j]
 [ 0.5+0.5j -0.5+0.5j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.R(targets, arg_value=None, **kwargs)[source]

Bases: SingleQubitGate

Arbitrary single-qubit rotation

\[\begin{split}\begin{pmatrix} \cos(\frac{\theta}{2}) & -ie^{-i\phi} \sin(\frac{\theta}{2}) \\ -ie^{i\phi} \sin(\frac{\theta}{2}) & \cos(\frac{\theta}{2}) \end{pmatrix}\end{split}\]

Examples

>>> from qutip_qip.operations import R
>>> R(0, (np.pi/2, np.pi/2)).get_compact_qobj().tidyup() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[ 0.70711 -0.70711]
 [ 0.70711  0.70711]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.RX(targets, arg_value, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit rotation RX.

Examples

>>> from qutip_qip.operations import RX
>>> RX(0, 3.14159/2).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[0.70711+0.j      0.     -0.70711j]
 [0.     -0.70711j 0.70711+0.j     ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.RY(targets, arg_value, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit rotation RY.

Examples

>>> from qutip_qip.operations import RY
>>> RY(0, 3.14159/2).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[ 0.70711 -0.70711]
 [ 0.70711  0.70711]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.RZ(targets, arg_value, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit rotation RZ.

Examples

>>> from qutip_qip.operations import RZ
>>> RZ(0, 3.14159/2).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[0.70711-0.70711j 0.     +0.j     ]
 [0.     +0.j      0.70711+0.70711j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.S(targets, **kwargs)[source]

Bases: SingleQubitGate

S gate or \(\sqrt{Z}\) gate.

Examples

>>> from qutip_qip.operations import S
>>> S(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[1.+0.j 0.+0.j]
 [0.+0.j 0.+1.j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

qutip_qip.operations.SNOT

alias of H

class qutip_qip.operations.SQRTISWAP(targets, **kwargs)[source]

Bases: TwoQubitGate

\(\sqrt{\mathrm{iSWAP}}\) gate.

Examples

>>> from qutip_qip.operations import SQRTISWAP
>>> SQRTISWAP([0, 1]).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1.     +0.j      0.     +0.j      0.     +0.j      0.     +0.j     ]
 [0.     +0.j      0.70711+0.j      0.     +0.70711j 0.     +0.j     ]
 [0.     +0.j      0.     +0.70711j 0.70711+0.j      0.     +0.j     ]
 [0.     +0.j      0.     +0.j      0.     +0.j      1.     +0.j     ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.SQRTNOT(targets, **kwargs)[source]

Bases: SingleQubitGate

\(\sqrt{X}\) gate.

Examples

>>> from qutip_qip.operations import SQRTNOT
>>> SQRTNOT(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[0.5+0.5j 0.5-0.5j]
 [0.5-0.5j 0.5+0.5j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.SQRTSWAP(targets, **kwargs)[source]

Bases: TwoQubitGate

\(\sqrt{\mathrm{SWAP}}\) gate.

Examples

>>> from qutip_qip.operations import SQRTSWAP
>>> SQRTSWAP([0, 1]).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1. +0.j  0. +0.j  0. +0.j  0. +0.j ]
 [0. +0.j  0.5+0.5j 0.5-0.5j 0. +0.j ]
 [0. +0.j  0.5-0.5j 0.5+0.5j 0. +0.j ]
 [0. +0.j  0. +0.j  0. +0.j  1. +0.j ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.SWAP(targets, **kwargs)[source]

Bases: TwoQubitGate

SWAP gate.

Examples

>>> from qutip_qip.operations import SWAP
>>> SWAP([0, 1]).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0.]
 [0. 0. 1. 0.]
 [0. 1. 0. 0.]
 [0. 0. 0. 1.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.SWAPALPHA(targets, arg_value, **kwargs)[source]

Bases: TwoQubitGate

SWAPALPHA gate.

\[\begin{split}\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & \frac{1 + e^{i\pi\alpha}}{2} & \frac{1 - e^{i\pi\alpha}}{2} & 0 \\ 0 & \frac{1 - e^{i\pi\alpha}}{2} & \frac{1 + e^{i\pi\alpha}}{2} & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}\end{split}\]

Examples

>>> from qutip_qip.operations import SWAPALPHA
>>> SWAPALPHA([0, 1], 0.5).get_compact_qobj() 
Quantum object: dims = [[2, 2], [2, 2]], shape = (4, 4), type = oper, isherm = False
Qobj data =
[[1. +0.j  0. +0.j  0. +0.j  0. +0.j ]
 [0. +0.j  0.5+0.5j 0.5-0.5j 0. +0.j ]
 [0. +0.j  0.5-0.5j 0.5+0.5j 0. +0.j ]
 [0. +0.j  0. +0.j  0. +0.j  1. +0.j ]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.T(targets, **kwargs)[source]

Bases: SingleQubitGate

T gate or \(\sqrt[4]{Z}\) gate.

Examples

>>> from qutip_qip.operations import T
>>> T(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False
Qobj data =
[[1.     +0.j      0.     +0.j     ]
 [0.     +0.j      0.70711+0.70711j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.TOFFOLI(targets, **kwargs)[source]

Bases: Gate

TOFFOLI gate.

Examples

>>> from qutip_qip.operations import TOFFOLI
>>> TOFFOLI([0, 1, 2]).get_compact_qobj() 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8, 8), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1.]
 [0. 0. 0. 0. 0. 0. 1. 0.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.X(targets, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit X gate.

Examples

>>> from qutip_qip.operations import X
>>> X(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[0. 1.]
 [1. 0.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.Y(targets, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit Y gate.

Examples

>>> from qutip_qip.operations import Y
>>> Y(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[0.+0.j 0.-1.j]
 [0.+1.j 0.+0.j]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

class qutip_qip.operations.Z(targets, **kwargs)[source]

Bases: SingleQubitGate

Single-qubit Z gate.

Examples

>>> from qutip_qip.operations import Z
>>> Z(0).get_compact_qobj() 
Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
Qobj data =
[[ 1.  0.]
 [ 0. -1.]]
get_compact_qobj()[source]

Get the compact qutip.Qobj representation of the gate operator, ignoring the controls and targets. In the unitary representation, it always assumes that the first few qubits are controls, then targets.

Returns
qobjqutip.Qobj

The compact gate operator as a unitary matrix.

qutip_qip.operations.berkeley(N=None, targets=[0, 1])[source]

Quantum object representing the Berkeley gate.

Returns
berkeley_gateqobj

Quantum object representation of Berkeley gate

Examples

>>> berkeley() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = True
Qobj data =
    [[ cos(pi/8).+0.j  0.+0.j           0.+0.j           0.+sin(pi/8).j]
     [ 0.+0.j          cos(3pi/8).+0.j  0.+sin(3pi/8).j  0.+0.j]
     [ 0.+0.j          0.+sin(3pi/8).j  cos(3pi/8).+0.j  0.+0.j]
     [ 0.+sin(pi/8).j  0.+0.j           0.+0.j           cos(pi/8).+0.j]]
qutip_qip.operations.cnot(N=None, control=0, target=1)[source]

Quantum object representing the CNOT gate.

Returns
cnot_gateqobj

Quantum object representation of CNOT gate

Examples

>>> cnot() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = True
Qobj data =
    [[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j]
     [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j]]
qutip_qip.operations.controlled_gate(U, controls=0, targets=1, N=None, control_value=1)[source]

Create an N-qubit controlled gate from a single-qubit gate U with the given control and target qubits.

Parameters
Uqutip.Qobj

An arbitrary unitary gate.

controlslist of int

The index of the first control qubit.

targetslist of int

The index of the target qubit.

Nint

The total number of qubits.

control_valueint

The decimal value of the controlled qubits that activates the gate U.

Returns
resultqobj

Quantum object representing the controlled-U gate.

qutip_qip.operations.cphase(theta, N=2, control=0, target=1)[source]

Returns quantum object representing the controlled phase shift gate.

Parameters
thetafloat

Phase rotation angle.

Ninteger

The number of qubits in the target space.

controlinteger

The index of the control qubit.

targetinteger

The index of the target qubit.

Returns
Uqobj

Quantum object representation of controlled phase gate.

qutip_qip.operations.cs_gate(N=None, control=0, target=1)[source]

Controlled S gate.

Returns
resultqutip.Qobj

Quantum object for operator describing the rotation.

qutip_qip.operations.csign(N=None, control=0, target=1)[source]

Quantum object representing the CSIGN gate.

Returns
csign_gateqobj

Quantum object representation of CSIGN gate

Examples

>>> csign() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = True
Qobj data =
    [[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  -1.+0.j]]
qutip_qip.operations.ct_gate(N=None, control=0, target=1)[source]

Controlled T gate.

Returns
resultqutip.Qobj

Quantum object for operator describing the rotation.

qutip_qip.operations.cy_gate(N=None, control=0, target=1)[source]

Controlled Y gate.

Returns
resultqutip.Qobj

Quantum object for operator describing the rotation.

qutip_qip.operations.cz_gate(N=None, control=0, target=1)[source]

Controlled Z gate.

Returns
resultqutip.Qobj

Quantum object for operator describing the rotation.

qutip_qip.operations.expand_operator(oper, N=None, targets=None, dims=None, cyclic_permutation=False, dtype=None)[source]

Expand an operator to one that acts on a system with desired dimensions.

Parameters
operqutip.Qobj

An operator that act on the subsystem, has to be an operator and the dimension matches the tensored dims Hilbert space e.g. oper.dims = [[2, 3], [2, 3]]

dimslist

A list of integer for the dimension of each composite system. E.g [2, 3, 2, 3, 4].

targetsint or list of int

The indices of subspace that are acted on. Permutation can also be realized by changing the orders of the indices.

Nint

Deprecated. Number of qubits. Please use dims.

cyclic_permutationboolean, optional

Deprecated. Expand for all cyclic permutation of the targets. E.g. if N=3 and oper is a 2-qubit operator, the result will be a list of three operators, each acting on qubits 0 and 1, 1 and 2, 2 and 0.

dtypestr, optional

Data type of the output Qobj. Only for qutip version larger than 5.

Returns
expanded_operqutip.Qobj

The expanded operator acting on a system with desired dimension.

Examples

>>> from qutip_qip.operations import expand_operator, x_gate, cnot
>>> import qutip
>>> expand_operator(x_gate(), dims=[2,3], targets=[0]) 
Quantum object: dims = [[2, 3], [2, 3]], shape = (6, 6), type = oper, isherm = True
Qobj data =
[[0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 1. 0.]
 [0. 0. 0. 0. 0. 1.]
 [1. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0.]]
>>> expand_operator(cnot(), dims=[2,2,2], targets=[1, 2]) 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8,
8), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1.]
 [0. 0. 0. 0. 0. 0. 1. 0.]]
>>> expand_operator(cnot(), dims=[2, 2, 2], targets=[2, 0]) 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = (8,
8), type = oper, isherm = True
Qobj data =
[[1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1.]
 [0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 1. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0.]]
qutip_qip.operations.fredkin(N=None, control=0, targets=[1, 2])[source]

Quantum object representing the Fredkin gate.

Returns
fredkin_gateqobj

Quantum object representation of Fredkin gate.

Examples

>>> fredkin() 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]], shape = [8, 8], type = oper, isHerm = True
Qobj data =
    [[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j]]
qutip_qip.operations.gate_sequence_product(U_list, left_to_right=True, inds_list=None, expand=False)[source]

Calculate the overall unitary matrix for a given list of unitary operations.

Parameters
U_list: list

List of gates implementing the quantum circuit.

left_to_right: Boolean, optional

Check if multiplication is to be done from left to right.

inds_list: list of list of int, optional

If expand=True, list of qubit indices corresponding to U_list to which each unitary is applied.

expand: Boolean, optional

Check if the list of unitaries need to be expanded to full dimension.

Returns
U_overallqobj

Unitary matrix corresponding to U_list.

overall_indslist of int, optional

List of qubit indices on which U_overall applies.

qutip_qip.operations.globalphase(theta, N=1)[source]

Returns quantum object representing the global phase shift gate.

Parameters
thetafloat

Phase rotation angle.

Returns
phase_gateqobj

Quantum object representation of global phase shift gate.

Examples

>>> phasegate(pi/4) 
Quantum object: dims = [[2], [2]], shape = [2, 2], type = oper, isHerm = False
Qobj data =
[[ 0.70710678+0.70710678j          0.00000000+0.j]
 [ 0.00000000+0.j          0.70710678+0.70710678j]]
qutip_qip.operations.hadamard_transform(N=1)[source]

Quantum object representing the N-qubit Hadamard gate.

Returns
qqobj

Quantum object representation of the N-qubit Hadamard gate.

qutip_qip.operations.iswap(N=None, targets=[0, 1])[source]

Quantum object representing the iSWAP gate.

Returns
iswap_gateqobj

Quantum object representation of iSWAP gate

Examples

>>> iswap() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = False
Qobj data =
[[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+1.j  0.+0.j]
 [ 0.+0.j  0.+1.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j]]
qutip_qip.operations.molmer_sorensen(theta, phi=0.0, N=None, targets=[0, 1])[source]

Quantum object of a Mølmer–Sørensen gate.

Parameters
theta: float

The duration of the interaction pulse.

phi: float

Rotation axis. phi = 0 for XX; phi=pi for YY

N: int

Number of qubits in the system.

target: int

The indices of the target qubits.

Returns
molmer_sorensen_gatequtip.Qobj

Quantum object representation of the Mølmer–Sørensen gate.

qutip_qip.operations.phasegate(theta, N=None, target=0)[source]

Returns quantum object representing the phase shift gate.

Parameters
thetafloat

Phase rotation angle.

Returns
phase_gateqobj

Quantum object representation of phase shift gate.

Examples

>>> phasegate(pi/4) 
Quantum object: dims = [[2], [2]], shape = [2, 2], type = oper, isHerm = False
Qobj data =
[[ 1.00000000+0.j          0.00000000+0.j        ]
 [ 0.00000000+0.j          0.70710678+0.70710678j]]
qutip_qip.operations.qasmu_gate(args, N=None, target=0)[source]

QASM U-gate as defined in the OpenQASM standard.

Parameters
thetafloat

The argument supplied to the last RZ rotation.

phifloat

The argument supplied to the middle RY rotation.

gammafloat

The argument supplied to the first RZ rotation.

Nint

Number of qubits in the system.

targetint

The index of the target qubit.

Returns
qasmu_gatequtip.Qobj

Quantum object representation of the QASM U-gate as defined in the OpenQASM standard.

qutip_qip.operations.qrot(theta, phi, N=None, target=0)[source]

Single qubit rotation driving by Rabi oscillation with 0 detune.

Parameters
phifloat

The inital phase of the rabi pulse.

thetafloat

The duration of the rabi pulse.

Nint

Number of qubits in the system.

targetint

The index of the target qubit.

Returns
qrot_gatequtip.Qobj

Quantum object representation of physical qubit rotation under a rabi pulse.

qutip_qip.operations.qubit_clifford_group(N=None, target=0)[source]

Generates the Clifford group on a single qubit, using the presentation of the group given by Ross and Selinger (http://www.mathstat.dal.ca/~selinger/newsynth/).

Parameters
Nint or None

Number of qubits on which each operator is to be defined (default: 1).

targetint

Index of the target qubit on which the single-qubit Clifford operators are to act.

Yields
opQobj

Clifford operators, represented as Qobj instances.

qutip_qip.operations.rotation(op, phi, N=None, target=0)[source]

Single-qubit rotation for operator op with angle phi.

Returns
resultqobj

Quantum object for operator describing the rotation.

qutip_qip.operations.rx(phi, N=None, target=0)[source]

Single-qubit rotation for operator sigmax with angle phi.

Returns
resultqobj

Quantum object for operator describing the rotation.

qutip_qip.operations.ry(phi, N=None, target=0)[source]

Single-qubit rotation for operator sigmay with angle phi.

Returns
resultqobj

Quantum object for operator describing the rotation.

qutip_qip.operations.rz(phi, N=None, target=0)[source]

Single-qubit rotation for operator sigmaz with angle phi.

Returns
resultqobj

Quantum object for operator describing the rotation.

qutip_qip.operations.s_gate(N=None, target=0)[source]

Single-qubit rotation also called Phase gate or the Z90 gate.

Returns
resultqutip.Qobj

Quantum object for operator describing a 90 degree rotation around the z-axis.

qutip_qip.operations.snot(N=None, target=0)[source]

Quantum object representing the SNOT (Hadamard) gate.

Returns
snot_gateqobj

Quantum object representation of SNOT gate.

Examples

>>> snot() 
Quantum object: dims = [[2], [2]], shape = [2, 2], type = oper, isHerm = True
Qobj data =
[[ 0.70710678+0.j  0.70710678+0.j]
 [ 0.70710678+0.j -0.70710678+0.j]]
qutip_qip.operations.sqrtiswap(N=None, targets=[0, 1])[source]

Quantum object representing the square root iSWAP gate.

Returns
sqrtiswap_gateqobj

Quantum object representation of square root iSWAP gate

Examples

>>> sqrtiswap() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = False
Qobj data =
[[ 1.00000000+0.j   0.00000000+0.j          0.00000000+0.j          0.00000000+0.j]
 [ 0.00000000+0.j   0.70710678+0.j          0.00000000-0.70710678j  0.00000000+0.j]
 [ 0.00000000+0.j   0.00000000-0.70710678j       0.70710678+0.j          0.00000000+0.j]
 [ 0.00000000+0.j   0.00000000+0.j          0.00000000+0.j          1.00000000+0.j]]
qutip_qip.operations.sqrtnot(N=None, target=0)[source]

Single-qubit square root NOT gate.

Returns
resultqobj

Quantum object for operator describing the square root NOT gate.

qutip_qip.operations.sqrtswap(N=None, targets=[0, 1])[source]

Quantum object representing the square root SWAP gate.

Returns
sqrtswap_gateqobj

Quantum object representation of square root SWAP gate

qutip_qip.operations.swap(N=None, targets=[0, 1])[source]

Quantum object representing the SWAP gate.

Returns
swap_gateqobj

Quantum object representation of SWAP gate

Examples

>>> swap() 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = True
Qobj data =
[[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j]
 [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j]]
qutip_qip.operations.swapalpha(alpha, N=None, targets=[0, 1])[source]

Quantum object representing the SWAPalpha gate.

Returns
swapalpha_gateqobj

Quantum object representation of SWAPalpha gate

Examples

>>> swapalpha(alpha) 
Quantum object: dims = [[2, 2], [2, 2]], shape = [4, 4], type = oper, isHerm = True
Qobj data =
[[ 1.+0.j  0.+0.j                    0.+0.j                    0.+0.j]
 [ 0.+0.j  0.5*(1 + exp(j*pi*alpha)  0.5*(1 - exp(j*pi*alpha)  0.+0.j]
 [ 0.+0.j  0.5*(1 - exp(j*pi*alpha)  0.5*(1 + exp(j*pi*alpha)  0.+0.j]
 [ 0.+0.j  0.+0.j                    0.+0.j                    1.+0.j]]
qutip_qip.operations.t_gate(N=None, target=0)[source]

Single-qubit rotation related to the S gate by the relationship S=T*T.

Returns
resultqutip.Qobj

Quantum object for operator describing a phase shift of pi/4.

qutip_qip.operations.toffoli(N=None, controls=[0, 1], target=2)[source]

Quantum object representing the Toffoli gate.

Returns
toff_gateqobj

Quantum object representation of Toffoli gate.

Examples

>>> toffoli() 
Quantum object: dims = [[2, 2, 2], [2, 2, 2]],                     shape = [8, 8], type = oper, isHerm = True
Qobj data =
    [[ 1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j  0.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j]
     [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  0.+0.j  1.+0.j  0.+0.j]]
qutip_qip.operations.x_gate(N=None, target=0)[source]

Pauli-X gate or sigmax operator.

Returns
resultqutip.Qobj

Quantum object for operator describing a single-qubit rotation through pi radians around the x-axis.

qutip_qip.operations.y_gate(N=None, target=0)[source]

Pauli-Y gate or sigmay operator.

Returns
resultqutip.Qobj

Quantum object for operator describing a single-qubit rotation through pi radians around the y-axis.

qutip_qip.operations.z_gate(N=None, target=0)[source]

Pauli-Z gate or sigmaz operator.

Returns
resultqutip.Qobj

Quantum object for operator describing a single-qubit rotation through pi radians around the z-axis.