gates

Contents

6.3. gates#

class CNOT[source]#

Bases: QuantumOperation

CNOT gate on two qubits.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

CNOT – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.CNOT

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

2 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Hadamard[source]#

Bases: QuantumOperation

Hadamard gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

Hadamard – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.Hadamard

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InversePhase(name)[source]#

Bases: QuantumOperation

Inverse phase shift gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `Phase`, which has the same name.

Returns:

Phase – Return an object of the class `Phase` with the same name. It corresponds to the inverse of this operation.

Return type:

geqo.core.fundamental_gates.Phase

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InverseRx(name)[source]#

Bases: QuantumOperation

Inverse rotation about X axis.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `Rx` with the same name for the angle.

Returns:

Rx – A new object of the class `Rx`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.Rx

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InverseRy(name)[source]#

Bases: QuantumOperation

Inverse rotation about Y axis.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `Ry` with the same name for the angle.

Returns:

Ry – A new object of the class `Ry`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.Ry

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InverseRz(name)[source]#

Bases: QuantumOperation

Inverse rotation about Z axis.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `Rz` with the same name for the angle.

Returns:

Rz – A new object of the class `Rz`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.Rz

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InverseRzz(name)[source]#

Bases: QuantumOperation

Inverse ZZ interaction between two qubits.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which contains several operations that correspond to this gate.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `Rzz` with the same name for the angle.

Returns:

Rzz – A new object of the class `Rzz`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.Rzz

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

2 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

True – This two-qubit operation can be decomposed into a sequence of two `CNOT` and one `InverseRz` gate.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class InverseSGate[source]#

Bases: QuantumOperation

This operation corresponds to the inverse of the square root of the Z gate on one qubit.

For the definition of the S gate, see `https://en.wikipedia.org/wiki/Clifford_gates#S_gate`.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `SGate`.

Returns:

SGate – A new object of this class, which corresponds to the inverse operation.

Return type:

geqo.gates.fundamental_gates.SGate

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class PauliX[source]#

Bases: QuantumOperation

Pauli X gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

PauliX – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.PauliX

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class PauliY[source]#

Bases: QuantumOperation

Pauli Y gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

PauliY – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.PauliY

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class PauliZ[source]#

Bases: QuantumOperation

Pauli Z gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

PauliZ – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.PauliZ

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Phase(name)[source]#

Bases: QuantumOperation

Phase shift gate on one qubit.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `InversePhase`, which has the same name.

Returns:

InversePhase – Return an object of the class `InversePhase` with the same name. It corresponds to the inverse of this operation.

Return type:

geqo.core.fundamental_gates.InversePhase

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Rx(name)[source]#

Bases: QuantumOperation

Rotation about X axis in Bloch sphere.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `InverseRx` with the same name for the angle.

Returns:

InverseRx – A new object of the class `InverseRx`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.InverseRx

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Ry(name)[source]#

Bases: QuantumOperation

Rotation about Y axis in Bloch sphere.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `InverseRy` with the same name for the angle.

Returns:

InverseRy – A new object of the class `InverseRy`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.InverseRy

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Rz(name)[source]#

Bases: QuantumOperation

Rotation about Z axis in Bloch sphere.

getEquivalentSequence()[source]#

Return a sequence, which is equivalent to this gate. Here, no `Sequence` object is returned because a basic gate cannot be decomposed.

Returns:

None – No `Sequence` object is returned because this gate cannot be decomposed.

Return type:

None

getInverse()[source]#

Return an object of the class `InverseRz` with the same name for the angle.

Returns:

InverseRz – A new object of the class `InverseRz`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.InverseRzz

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

1 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This rotation on a single qubit is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Rzz(name)[source]#

Bases: QuantumOperation

ZZ interaction between two qubits.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which contains several operations that correspond to this gate.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `InverseRzz` with the same name for the angle.

Returns:

InverseRzz – A new object of the class `InverseRzz`, which corresponds to the inverse operation.

Return type:

geqo.gates.rotation_gates.InverseRzz

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

2 – The number of qubits, which are used by this rotation gate.

Return type:

int

hasDecomposition()[source]#
Returns:

True – This two-qubit operation can be decomposed into a sequence of two `CNOT` and one `Rz` gate.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class SGate[source]#

Bases: QuantumOperation

This operation corresponds to the square root of the Z gate on one qubit.

For the definition, see `https://en.wikipedia.org/wiki/Clifford_gates#S_gate`.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return an object of the class `InverseSGate`.

Returns:

InverseSGate – A new object of this class, which corresponds to the inverse operation.

Return type:

geqo.gates.fundamental_gates.InverseSGate

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

1 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class SwapQubits[source]#

Bases: QuantumOperation

Swap gate on two qubits.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which does not contain any operators, because this operation is considered to be as a non-decomposable operation.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the object itself because it is self-inverse.

Returns:

SwapQubits – The same object because it is self-inverse.

Return type:

geqo.core.fundamental_gates.SwapQubits

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this operation.

Returns:

2 – The number of qubits, which are used by this gate.

Return type:

int

hasDecomposition()[source]#
Returns:

False – This operation is considered to be as a non-decomposable operation.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool

class Toffoli(nameSpacePrefix='')[source]#

Bases: QuantumOperation

Toffoli (CCNOT) gate on three qubits.

getEquivalentSequence()[source]#

Return an object of the class `Sequence`, which contains several operations that correspond to the Toffoli gate. The name space prefix is prepended to all internal gates when needed.

Returns:

sequence – An object of the class `Sequence` without operations, but with the appropriate bits and qubits. The name space prefix is prepended to all internal gates when needed.

Return type:

geqo.core.Sequence

getInverse()[source]#

Return the same object, because it is inverse to itself.

Returns:

Toffoli – Return the object, because it is self-inverse.

Return type:

geqo.gates.multi_qubit_gates.Toffoli

getNumberClassicalBits()[source]#
Returns:

0 – The number of classical bits, which are used by PermuteQubits, is zero.

Return type:

int

getNumberQubits()[source]#

Return the number of qubits that are used by this permuation operation.

Returns:

3 – The Toffoli gate acts on 3 qubits.

Return type:

int

hasDecomposition()[source]#
Returns:

True – The Toffoli gate can be decomposed into a sequence of simpler gates.

Return type:

Bool

isUnitary()[source]#
Returns:

True – This is a unitary operation.

Return type:

Bool