qat.integrations.tket module
- class TketBuilder(hardware_model)
Bases:
InstructionBuilderAssembles a TKET circuit using the InstructionBuilder interface.
- ECR(qubit1, qubit2)
- U(qubit, theta, phi, lamd)
- X(qubit, theta=None)
- Y(qubit, theta=None)
- Z(qubit, theta=None)
- cX(control, target, theta=3.141592653589793)
- cY(control, target, theta=3.141592653589793)
- cZ(control, target, theta=3.141592653589793)
- ccnot(control1, control2, target)
- cnot(control, target)
- controlled(*args)
- get_logical_qubit(index)
The TketBuilder doesn’t distinguish between physical and logical qubits, so this is identical to get_physical_qubit.
- Return type:
Qubit
- get_physical_qubit(index)
Returns the qubit assigned with the given physical index.
- Parameters:
index¶ (
int) – The index of the qubit to return.- Return type:
Qubit- Returns:
The qubit with the given index.
- measure_single_shot_z(qubit, output_variable=None, **kwargs)
- measure_with_granular_post_processing(qubit, output_variable=None, **kwargs)
Measure a qubit and emit the full granular post-processing pipeline.
Compiler frontends should call this method when lowering a measurement assignment into IR. The granular discrimination chain is emitted for both qubits with
post_process_methodconfigured and legacy qubits. For configured qubits, the chain (for exampleEqualise→Discriminate) is derived from the configured post-processing method; for legacy qubits, the equivalent granular chain is derived from legacymean_z_map_argsdata.See
QuantumInstructionBuilder.measure_with_granular_post_processing()for full detail.
- property qubits: list[Qubit]
Returns the list of qubits, sorted by index.
- reset(qubit, **kwargs)
- swap(qubit1, qubit2)
- class TketOptimisationHelper(circuit, opts, hardware)
Bases:
objectHelper class to run pydantic tket optimizations.
- convert_to_qasm_string()
- run_multi_qubit_optimizations(use_1q_quality=False)
- run_one_qubit_optimizations()
- run_optimizations()
- class TketToQatIRConverter
Bases:
objectConverts a Tket circuit into Qat IR.
Essentially the “parser” for Tket circuits.
Warning
This converter is only intended to be used to convert a TKET circuit into QAT IR after being parsed from QIR. It does not account for multiple quantum and classical registers, and might give undesired behaviour if used outside of this use case.
- convert(qat_builder, tket_builder, post_selection=False)
Converts a Tket circuit into Qat IR, adding any necessary assigns and returns.
- Parameters:
qat_builder¶ (
InstructionBuilder) – The QAT instruction builder.tket_builder¶ (
TketBuilder) – The Tket circuit builder.post_selection¶ (
bool) – Whether to emit PostSelect instructions during measurement.
- Return type:
- static convert_parameter(arg)
A parameter stored in a Tket operation is in units of \(\pi\).
Parameters are returned as a string expression, e.g. sometimes containing multiplication and division. These expressions are parsed using sympy.
- run_pyd_tket_optimizations(circuit, opts, hardware, return_as_qasm_str=True)
Runs tket-based optimizations and modifications given a Pydantic hardware model. Routing will always happen no matter the level.
Will run optimizations in sections if a full suite fails until a minimal subset of passing optimizations is found.
- Return type:
- run_tket_optimizations(circuit, opts, hardware, return_as_qasm_str=True)
Runs tket-based optimizations and modifications given a Pydantic hardware model. Routing will always happen no matter the level.
Will run optimizations in sections if a full suite fails until a minimal subset of passing optimizations is found.
- Return type: