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)
- 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)
Converts a Tket circuit into Qat IR, adding any necesarry assigns and returns.
- Parameters:
- 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: