pytket.tailoring

The tailoring module provides access to noise tailoring tools.

class pytket.tailoring.FrameRandomisation

The base FrameRandomisation class. FrameRandomisation finds subcircuits (cycles) of a given circuit comprised of gates with OpType only from a specified set of OpType, and wires gates into the boundary (frame) of these cycles. Input frame gates are sampled from another set of OpType, and output frame gates deduced such that the circuit unitary doesn’t change, achieved by computing the action of cycle gates on frame gates.

__init__(self: pytket.tailoring.FrameRandomisation, arg0: Set[pytket.circuit.OpType], arg1: Set[pytket.circuit.OpType], arg2: Dict[pytket.circuit.OpType, Dict[tuple, tuple]]) None

Constructor for FrameRandomisation.

Parameters
  • cycletypes – A set of OpType corresponding to the gates cycles found are comprised of

  • frametypes – A set of OpType corresponding to the gates Frames are sampled from

  • conjugates – A map from cycle OpType, to a map between Frame OptypeVector giving the required change to output frame OpType to preserve Unitary from given input frame OpType.

get_all_circuits(self: pytket.tailoring.FrameRandomisation, circuit: pytket.circuit.Circuit) List[pytket.circuit.Circuit]

For given circuit, finds all Cycles, finds all frames for each Cycle, and returns every combination of frame and cycle in a vector of Circuit.

Parameters

circuit – The circuit to find frames for.

Returns

list of Circuit s

sample_circuits(self: pytket.tailoring.FrameRandomisation, circuit: pytket.circuit.Circuit, samples: int) List[pytket.circuit.Circuit]

Returns a number of instances equal to sample of frame randomisation for the given circuit. Samples individual frame gates uniformly.

Parameters
  • circuit – The circuit to perform frame randomisation with Pauli gates on

  • samples – the number of frame randomised circuits to return.

Returns

list of Circuit s

class pytket.tailoring.PauliFrameRandomisation

The PauliFrameRandomisation class. PauliFrameRandomisation finds subcircuits (cycles) of a given circuit comprised of gates with OpType::H, OpType::CX and OpType::S, and wires gates into the boundary (frame) of these cycles. Input frame gates are sampled from another set of OpType comprised of the Pauli gates, and output frame gates deduced such that the circuit unitary doesn’t change, achieved by computing the action of cycle gates on frame gates.

__init__(self: pytket.tailoring.PauliFrameRandomisation) None

Constructor for PauliFrameRandomisation.

get_all_circuits(self: pytket.tailoring.PauliFrameRandomisation, circuit: pytket.circuit.Circuit) List[pytket.circuit.Circuit]

For given circuit, finds all Cycles, finds all frames for each Cycle, and returns every combination of frame and cycle in a vector of Circuit.

Parameters

circuit – The circuit to find frames for.

Returns

list of Circuit s

sample_circuits(self: pytket.tailoring.PauliFrameRandomisation, circuit: pytket.circuit.Circuit, samples: int) List[pytket.circuit.Circuit]

Returns a number of instances equal to sample of frame randomisation for the given circuit. Samples individual frame gates uniformly from the Pauli gates.

Parameters
  • circuit – The circuit to perform frame randomisation with Pauli gates on

  • samples – the number of frame randomised circuits to return.

Returns

list of Circuit s

class pytket.tailoring.UniversalFrameRandomisation

The UniversalFrameRandomisation class. UniversalFrameRandomisation finds subcircuits (cycles) of a given circuit comprised of gates with OpType::H, OpType::CX, and OpType::Rz, and wires gates into the boundary (frame) of these cycles. Input frame gates are sampled from another set of OpType comprised of the Pauli gates, and output frame gates deduced such that the circuit unitary doesn’t change, achieved by computing the action of cycle gates on frame gates. Some gates with OpType::Rz may be substituted for their dagger to achieve this.

__init__(self: pytket.tailoring.UniversalFrameRandomisation) None

Constructor for UniversalFrameRandomisation.

get_all_circuits(self: pytket.tailoring.UniversalFrameRandomisation, circuit: pytket.circuit.Circuit) List[pytket.circuit.Circuit]

For given circuit, finds all Cycles, finds all frames for each Cycle, and returns every combination of frame and cycle in a vector of Circuit.

Parameters

circuit – The circuit to find frames for.

Returns

list of Circuit s

sample_circuits(self: pytket.tailoring.UniversalFrameRandomisation, circuit: pytket.circuit.Circuit, samples: int) List[pytket.circuit.Circuit]

Returns a number of instances equal to sample of frame randomisation for the given circuit. Samples individual frame gates uniformly from the Pauli gates.

Parameters
  • circuit – The circuit to perform frame randomisation with Pauli gates on

  • samples – the number of frame randomised circuits to return.

Returns

list of Circuit s

pytket.tailoring.apply_clifford_basis_change(pauli: pytket.pauli.QubitPauliString, circuit: pytket.circuit.Circuit) pytket.pauli.QubitPauliString

Given Pauli operator P and Clifford circuit C, returns C_dagger.P.C in multiplication order. This ignores any -1 phase that could be introduced.

Parameters
  • pauli – Pauli operator being transformed.

  • circuit – Clifford circuit acting on Pauli operator.

Returns

QubitPauliString for new operator