QuantumExtension

class tket.extensions.QuantumExtension[source]

Bases: TketExtension

TKET’s standard quantum operations.

property CRz: ExtOp

Controlled Rz rotation with angle parameter.

property CX: ExtOp

Controlled-X (CNOT).

property CY: ExtOp

Controlled-Y.

property CZ: ExtOp

Controlled-Z.

property H: ExtOp

Hadamard.

OPS()[source]

Return the operations defined by this extension

Return type:

list[OpDef]

property Rx: ExtOp

Rotate around X by a rotation parameter.

property Ry: ExtOp

Rotate around Y by a rotation parameter.

property Rz: ExtOp

Rotate around Z by a rotation parameter.

property S: ExtOp

S phase gate (pi/2 around Z).

property Sdg: ExtOp

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

property T: ExtOp

T phase gate (pi/4 around Z).

TYPES()[source]

Return the types defined by this extension

Return type:

list[TypeDef]

property Tdg: ExtOp

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

property V: ExtOp

V gate (sqrt(X)).

property Vdg: ExtOp

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

property X: ExtOp

Pauli-X.

property Y: ExtOp

Pauli-Y.

property Z: ExtOp

Pauli-Z.

__call__()[source]

Returns the quantum extension

Return type:

Extension

__init__()
property measure: ExtOp

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

property measure_free: ExtOp

Measure a qubit producing an opaque bool (qubit consumed).

property qAlloc: ExtOp

Allocate a new qubit in |0>.

property qFree: ExtOp

Free a qubit (lose track).

property reset: ExtOp

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

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

Toffoli (CCX).

property try_QAlloc: ExtOp

Try allocate a qubit, returning None on failure.

property version: Version

The version of the extension