API documentation¶
- pytket.extensions.pyzx.pyzx_convert.pyzx_to_tk(pyzx_circ)[source]¶
Convert a
pyzx.circuit.Circuitto a tketCircuit. Runpyzx.circuit.Circuit.to_basic_gates()before conversion.
- pytket.extensions.pyzx.pyzx_convert.pyzx_to_tk_arc(pyzx_arc)[source]¶
Convert a pyzx
pyzx.routing.architecture.Architectureto a pytketArchitecture.- Parameters:
pytket_arc – A Architecture to be converted
- Return type:
- Returns:
The converted pyzx Architecture
- pytket.extensions.pyzx.pyzx_convert.pyzx_to_tk_placed_circ(pyzx_circ, q_map)[source]¶
Convert a
pyzx.circuit.Circuitand a placment map to a placed tketCircuit. Runpyzx.circuit.Circuit.to_basic_gates()before conversion.- Parameters:
pyzx_circ (
Circuit) – A circuit to be convertedq_map (
dict[UnitID,UnitID]) – placment map to assign each of the qubits in the pyzx circuit to one of the architecture nodes. It is recommended to use here the map generated bytk_to_pyzx_placed_circ()
- Return type:
- Returns:
The converted pytket circuit
- pytket.extensions.pyzx.pyzx_convert.tk_to_pyzx(tkcircuit, denominator_limit=1000000)[source]¶
Convert a tket
Circuitto apyzx.circuit.Circuit.- Parameters:
tkcircuit (
Circuit) – A circuit to be converteddenominator_limit (
int) – The limit for denominator size when converting floats to fractions. Smaller limits allow for correct representation of simple fractions with non-exact floating-point representations, while larger limits allow for more precise angles.
- Return type:
- Returns:
The converted circuit
- pytket.extensions.pyzx.pyzx_convert.tk_to_pyzx_arc(pytket_arc, pyzx_arc_name='')[source]¶
Convert a pytket
Architectureto a pyzxpyzx.routing.architecture.Architecture. The conversion will remove all the node names and will keep them only integer named in the order they are given in the node set of pytket_arc.- Parameters:
pytket_arc (
Architecture) – A Architecture to be convertedpyzx_arc_name (
str) – Name of the architecture in pyzx
- Return type:
- Returns:
The converted pyzx Architecture
- pytket.extensions.pyzx.pyzx_convert.tk_to_pyzx_placed_circ(pytket_circ, pytket_arc, denominator_limit=1000000, pyzx_arc_name='')[source]¶
Convert a (placed) tket
Circuitwith a givenArchitectureto apyzx.circuit.Circuitand thepyzx.routing.architecture.Architectureand a map to give the information for converting the pyzx circuit back to pytket circuit usingpyzx_to_tk_placed_circ()assigning each of the circuit qubits a one of the architecture nodes- Parameters:
pytket_circ (
Circuit) – A circuit to be convertedpytket_arc (
Architecture) – Corresponding Architecturedenominator_limit (
int) – The limit for denominator size when converting floats to fractions. Smaller limits allow for correct representation of simple fractions with non-exact floating-point representations, while larger limits allow for more precise angles.pyzx_arc_name (
str) – Name of the architecture in pyzx
- Return type:
- Returns:
Tuple containing generated
pyzx.circuit.Circuit,pyzx.routing.architecture.Architectureand a map to give the information for converting the pyzx circuit back to pytket circuit usingpyzx_to_tk_placed_circ()assigning each of the circuit qubits a one of the architecture nodes