mirror of https://github.com/Qiskit/qiskit.git
* tiny follow up * Update releasenotes/notes/deprecate-StochasticSwap-451f46b273602b7b.yaml Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com> --------- Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
This commit is contained in:
parent
aa09a027be
commit
b90c7a706f
|
@ -63,8 +63,8 @@ class StochasticSwap(TransformationPass):
|
|||
@deprecate_func(
|
||||
since="1.3",
|
||||
removal_timeline="in the 2.0 release",
|
||||
additional_msg="The `StochasticSwap` transpilation pass is a suboptimal "
|
||||
"routing algorithm and has been superseded by the :class:`.SabreSwap` pass.",
|
||||
additional_msg="The StochasticSwap transpilation pass is a suboptimal "
|
||||
"routing algorithm and has been superseded by the SabreSwap pass.",
|
||||
)
|
||||
def __init__(self, coupling_map, trials=20, seed=None, fake_run=False, initial_layout=None):
|
||||
"""StochasticSwap initializer.
|
||||
|
|
|
@ -1,45 +1,49 @@
|
|||
---
|
||||
deprecations_transpiler:
|
||||
- |
|
||||
Deprecated ``StochasticSwap`` which has been superseded by :class:`.SabreSwap`.
|
||||
Deprecated :class:`.StochasticSwap` which has been superseded by :class:`.SabreSwap`.
|
||||
If the class is called from the transpile function, the change would be, for example::
|
||||
|
||||
from qiskit import transpile
|
||||
from qiskit.circuit import QuantumCircuit
|
||||
from qiskit.transpiler import CouplingMap
|
||||
from qiskit.providers.fake_provider import GenericBackendV2
|
||||
|
||||
|
||||
qc = QuantumCircuit(4)
|
||||
qc.h(0)
|
||||
qc.cx(0, range(1, 4))
|
||||
qc.measure_all()
|
||||
|
||||
cmap = CouplingMap.from_heavy_hex(3)
|
||||
backend = GenericBackendV2(num_qubits=cmap.size(), coupling_map=cmap)
|
||||
|
||||
tqc = transpile(
|
||||
circuit,
|
||||
qc,
|
||||
routing_method="stochastic",
|
||||
layout_method="dense",
|
||||
seed_transpiler=12342,
|
||||
target=GenericBackendV2(
|
||||
num_qubits=27,
|
||||
coupling_map=MUMBAI_CMAP,
|
||||
).target,
|
||||
target=backend.target
|
||||
)
|
||||
|
||||
to::
|
||||
|
||||
tqc = transpile(
|
||||
circuit,
|
||||
qc,
|
||||
routing_method="sabre",
|
||||
layout_method="sabre",
|
||||
seed_transpiler=12342,
|
||||
target=GenericBackendV2(
|
||||
num_qubits=27,
|
||||
coupling_map=MUMBAI_CMAP,
|
||||
).target,
|
||||
target=backend.target
|
||||
)
|
||||
|
||||
While for a pass mananager change::
|
||||
While for a pass manager, the change would be::
|
||||
|
||||
qr = QuantumRegister(4, "q")
|
||||
qc = QuantumCircuit(qr)
|
||||
passmanager = PassManager(StochasticSwap(coupling, 20, 13))
|
||||
new_qc = passmanager.run(qc)
|
||||
|
||||
to::
|
||||
|
||||
qr = QuantumRegister(5, "q")
|
||||
qc = QuantumCircuit(qr)
|
||||
passmanager = PassManager(SabreSwap(target, "basic"))
|
||||
passmanager = PassManager(SabreSwap(backend.target, "basic"))
|
||||
new_qc = passmanager.run(qc)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue