deltakit.circuit.Circuit.as_stim_circuit#

Circuit.as_stim_circuit(qubit_mapping: Mapping[Qubit[T], int] | None = None) Circuit#

Get the equivalent Stim circuit from this deltakit_circuit circuit.

Parameters:

qubit_mapping (Mapping[Qubit[T], int] | None, optional) – A way to associate an integer with every qubit type. This is necessary because Stim represents qubits as single integers. This mapping should be injective. If not specified, deltakit_circuit will try to create a mapping from the qubits specified.

Returns:

The equivalent Stim circuit.

Return type:

stim.Circuit

Examples

>>> import deltakit_circuit as sp
>>> circuit = sp.Circuit(sp.GateLayer([sp.gates.X(0), sp.gates.Y(1)]))
>>> circuit.as_stim_circuit()
stim.Circuit('''
    X 0
    Y 1
''')
>>> circuit.as_stim_circuit(qubit_mapping={Qubit(0): 1, Qubit(1): 0})
stim.Circuit('''
    X 1
    Y 0
''')