pytket.tailoring

The tailoring module provides access to noise tailoring tools.

class pytket._tket.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._tket.tailoring.FrameRandomisation, arg0: set[pytket._tket.circuit.OpType], arg1: set[pytket._tket.circuit.OpType], arg2: dict[pytket._tket.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._tket.tailoring.FrameRandomisation, circuit: pytket._tket.circuit.Circuit) list[pytket._tket.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._tket.tailoring.FrameRandomisation, circuit: pytket._tket.circuit.Circuit, samples: int) list[pytket._tket.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._tket.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._tket.tailoring.PauliFrameRandomisation) None

Constructor for PauliFrameRandomisation.

get_all_circuits(self: pytket._tket.tailoring.PauliFrameRandomisation, circuit: pytket._tket.circuit.Circuit) list[pytket._tket.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._tket.tailoring.PauliFrameRandomisation, circuit: pytket._tket.circuit.Circuit, samples: int) list[pytket._tket.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._tket.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._tket.tailoring.UniversalFrameRandomisation) None

Constructor for UniversalFrameRandomisation.

get_all_circuits(self: pytket._tket.tailoring.UniversalFrameRandomisation, circuit: pytket._tket.circuit.Circuit) list[pytket._tket.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._tket.tailoring.UniversalFrameRandomisation, circuit: pytket._tket.circuit.Circuit, samples: int) list[pytket._tket.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._tket.tailoring.apply_clifford_basis_change(pauli: pytket._tket.pauli.QubitPauliString, circuit: pytket._tket.circuit.Circuit) pytket._tket.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

pytket._tket.tailoring.apply_clifford_basis_change_tensor(pauli: pytket._tket.pauli.QubitPauliTensor, circuit: pytket._tket.circuit.Circuit) pytket._tket.pauli.QubitPauliTensor

Given Pauli operator P and Clifford circuit C, returns C_dagger.P.C in multiplication order

Parameters:
  • pauli – Pauli operator being transformed.

  • circuit – Clifford circuit acting on Pauli operator.

Returns:

QubitPauliTensor for new operator