QuantumExtension

class tket.extensions.QuantumExtension[source]

Bases: TketExtension

TKET’s standard quantum operations.

property CRz: ExtOp[source]

Controlled Rz rotation with angle parameter.

property CX: ExtOp[source]

Controlled-X (CNOT).

property CY: ExtOp[source]

Controlled-Y.

property CZ: ExtOp[source]

Controlled-Z.

property H: ExtOp[source]

Hadamard.

OPS()[source]

Return the operations defined by this extension

Return type:

list[OpDef]

property Rx: ExtOp[source]

Rotate around X by a rotation parameter.

property Ry: ExtOp[source]

Rotate around Y by a rotation parameter.

property Rz: ExtOp[source]

Rotate around Z by a rotation parameter.

property S: ExtOp[source]

S phase gate (pi/2 around Z).

property Sdg: ExtOp[source]

S dagger gate (-pi/2 around Z).

property T: ExtOp[source]

T phase gate (pi/4 around Z).

TYPES()[source]

Return the types defined by this extension

Return type:

list[TypeDef]

property Tdg: ExtOp[source]

T dagger gate (-pi/4 around Z).

property V: ExtOp[source]

V gate (sqrt(X)).

property Vdg: ExtOp[source]

V dagger gate (sqrt(X))^-1.

property X: ExtOp[source]

Pauli-X.

property Y: ExtOp[source]

Pauli-Y.

property Z: ExtOp[source]

Pauli-Z.

__call__() → Extension[source]

Returns the quantum extension

Return type:

Extension

__init__()
property measure: ExtOp[source]

Measure a qubit producing a classical result (and keep the qubit).

property measure_free: ExtOp[source]

Measure a qubit producing a measurement (qubit consumed).

property qAlloc: ExtOp[source]

Allocate a new qubit in |0>.

property qFree: ExtOp[source]

Free a qubit (lose track).

property reset: ExtOp[source]

Reset a qubit to |0>.

symbolic_angle(expr)[source]

Store a sympy expression evaluable to a rotation angle.

Return type:

ExtOp

Args:

expr: A sympy expression as a string.

property symbolic_angle_def: OpDef[source]

Store a sympy expression evaluable to a rotation angle.

This is the generic operation definition. For the instantiated operation, see symbolic_angle.

property toffoli: ExtOp[source]

Toffoli (CCX).

property try_QAlloc: ExtOp[source]

Try allocate a qubit, returning None on failure.

property version: Version

The version of the extension