UnitarySynthesis
class UnitarySynthesis(basis_gates=None, approximation_degree=1, coupling_map=None, backend_props=None, pulse_optimize=None, natural_direction=None, synth_gates=None, method='default', min_qubits=None, plugin_config=None, target=None)
Bases: qiskit.transpiler.basepasses.TransformationPass
Synthesize gates according to their basis gates.
Synthesize unitaries over some basis gates.
This pass can approximate 2-qubit unitaries given some approximation closeness measure (expressed as approximation_degree
). Other unitaries are synthesized exactly.
Parameters
- basis_gates (list[str]) – List of gate names to target. If this is not specified the
target
argument must be used. If both this and thetarget
are specified the value oftarget
will be used and this will be ignored. - approximation_degree (float) – Closeness of approximation (0: lowest, 1: highest).
- coupling_map (CouplingMap) – the coupling map of the backend in case synthesis is done on a physical circuit. The directionality of the coupling_map will be taken into account if
pulse_optimize
isTrue
/None
andnatural_direction
isTrue
/None
. - backend_props (BackendProperties) – Properties of a backend to synthesize for (e.g. gate fidelities).
- pulse_optimize (bool) – Whether to optimize pulses during synthesis. A value of
None
will attempt it but fall back if it does not succeed. A value ofTrue
will raise an error if pulse-optimized synthesis does not succeed. - natural_direction (bool) – Whether to apply synthesis considering directionality of 2-qubit gates. Only applies when
pulse_optimize
isTrue
orNone
. The natural direction is determined by first checking to see whether the coupling map is unidirectional. If there is no coupling map or the coupling map is bidirectional, the gate direction with the shorter duration from the backend properties will be used. If set to True, and a natural direction can not be determined, raisesTranspileError
. If set to None, no exception will be raised if a natural direction can not be determined. - synth_gates (list[str]) – List of gates to synthesize. If None and
pulse_optimize
is False or None, default to['unitary']
. IfNone
andpulse_optimize == True
, default to['unitary', 'swap']
- method (str) – The unitary synthesis method plugin to use.
- min_qubits (
Optional
[int
]) – The minimum number of qubits in the unitary to synthesize. If this is set and the unitary is less than the specified number of qubits it will not be synthesized. - plugin_config (
Optional
[dict
]) – Optional extra configuration arguments (as adict
) which are passed directly to the specified unitary synthesis plugin. By default, this will have no effect as the default plugin has no extra arguments. Refer to the documentation of your unitary synthesis plugin on how to use this. - target (
Optional
[Target
]) – The optionalTarget
for the target device the pass is compiling for. If specified this will supersede the values set forbasis_gates
,coupling_map
, andbackend_props
.
Methods
name
UnitarySynthesis.name()
Return the name of the pass.
run
UnitarySynthesis.run(dag)
Run the UnitarySynthesis pass on dag
.
Parameters
dag (DAGCircuit
) – input dag.
Return type
Returns
Output dag with UnitaryGates synthesized to target basis.
Raises
TranspilerError – if method
was specified for the class and is not found in the installed plugins list. The list of installed plugins can be queried with unitary_synthesis_plugin_names()
Attributes
is_analysis_pass
Check if the pass is an analysis pass.
If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.
is_transformation_pass
Check if the pass is a transformation pass.
If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).