@@ -62,61 +62,60 @@ def transpile(circuits: Union[QuantumCircuit, List[QuantumCircuit]],
62
62
will override the backend's.
63
63
64
64
.. note::
65
+
65
66
The backend arg is purely for convenience. The resulting
66
67
circuit may be run on any backend as long as it is compatible.
67
- basis_gates: List of basis gate names to unroll to.
68
- e.g::
69
- ['u1', 'u2', 'u3', 'cx']
70
- If ``None``, do not unroll.
68
+ basis_gates: List of basis gate names to unroll to
69
+ (e.g: ``['u1', 'u2', 'u3', 'cx']``). If ``None``, do not unroll.
71
70
coupling_map: Coupling map (perhaps custom) to target in mapping.
72
71
Multiple formats are supported:
73
- 1. ``CouplingMap`` instance
74
- 2. List
75
- Must be given as an adjacency matrix, where each entry
76
- specifies all two-qubit interactions supported by backend,
77
- e.g::
78
- [[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]
72
+
73
+ #. ``CouplingMap`` instance
74
+ #. List, must be given as an adjacency matrix, where each entry
75
+ specifies all two-qubit interactions supported by backend,
76
+ e.g: ``[[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]``
77
+
79
78
backend_properties: properties returned by a backend, including information on gate
80
79
errors, readout errors, qubit coherence times, etc. Find a backend
81
80
that provides this information with: ``backend.properties()``
82
81
initial_layout: Initial position of virtual qubits on physical qubits.
83
82
If this layout makes the circuit compatible with the coupling_map
84
- constraints, it will be used.
85
- The final layout is not guaranteed to be the same, as the transpiler
86
- may permute qubits through swaps or other means.
83
+ constraints, it will be used. The final layout is not guaranteed to be the same,
84
+ as the transpiler may permute qubits through swaps or other means.
87
85
Multiple formats are supported:
88
86
89
- 1. ``Layout`` instance
90
-
91
- 2. Dict
92
-
93
- * virtual to physical::
87
+ #. ``Layout`` instance
88
+ #. Dict
89
+ * virtual to physical::
94
90
95
91
{qr[0]: 0,
96
92
qr[1]: 3,
97
93
qr[2]: 5}
98
94
99
- * physical to virtual::
95
+ * physical to virtual::
100
96
101
97
{0: qr[0],
102
98
3: qr[1],
103
99
5: qr[2]}
104
- 3. List
105
100
106
- * virtual to physical::
101
+ #. List
102
+
103
+ * virtual to physical::
107
104
108
105
[0, 3, 5] # virtual qubits are ordered (in addition to named)
109
- * physical to virtual::
106
+
107
+ * physical to virtual::
110
108
111
109
[qr[0], None, None, qr[1], None, qr[2]]
110
+
112
111
seed_transpiler: Sets random seed for the stochastic parts of the transpiler
113
112
optimization_level: How much optimization to perform on the circuits.
114
113
Higher levels generate more optimized circuits,
115
114
at the expense of longer transpilation time.
116
- * 0: no optimization
117
- * 1: light optimization
118
- * 2: heavy optimization
119
- * 3: even heavier optimization
115
+ * 0: no optimization
116
+ * 1: light optimization
117
+ * 2: heavy optimization
118
+ * 3: even heavier optimization
120
119
If ``None``, level 1 will be chosen as default.
121
120
pass_manager: The pass manager to use for a custom pipeline of transpiler passes.
122
121
If this arg is present, all other args will be ignored and the
@@ -125,17 +124,18 @@ def transpile(circuits: Union[QuantumCircuit, List[QuantumCircuit]],
125
124
callback: A callback function that will be called after each
126
125
pass execution. The function will be called with 5 keyword
127
126
arguments,
128
- | ``pass_``: the pass being run.
129
- | ``dag``: the dag output of the pass.
130
- | ``time``: the time to execute the pass.
131
- | ``property_set``: the property set.
132
- | ``count``: the index for the pass execution.
127
+ | ``pass_``: the pass being run.
128
+ | ``dag``: the dag output of the pass.
129
+ | ``time``: the time to execute the pass.
130
+ | ``property_set``: the property set.
131
+ | ``count``: the index for the pass execution.
133
132
The exact arguments passed expose the internals of the pass manager,
134
133
and are subject to change as the pass manager internals change. If
135
134
you intend to reuse a callback function over multiple releases, be
136
135
sure to check that the arguments being passed are the same.
137
136
To use the callback feature, define a function that will
138
137
take in kwargs dict and access the variables. For example::
138
+
139
139
def callback_func(**kwargs):
140
140
pass_ = kwargs['pass_']
141
141
dag = kwargs['dag']
@@ -144,6 +144,7 @@ def callback_func(**kwargs):
144
144
count = kwargs['count']
145
145
...
146
146
transpile(circ, callback=callback_func)
147
+
147
148
output_name: A list with strings to identify the output circuits. The length of
148
149
the list should be exactly the length of the ``circuits`` parameter.
149
150
0 commit comments