qiskit.transpiler.passes.UnitarySynthesis¶

class
UnitarySynthesis
(basis_gates, approximation_degree=1, coupling_map=None, backend_props=None, pulse_optimize=None, natural_direction=None, synth_gates=None)[source]¶ Synthesize gates according to their basis gates.
Synthesize unitaries over some basis gates.
This pass can approximate 2qubit 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.approximation_degree (
float
) – Closeness of approximation (0: lowest, 1: highest).backend_props (
Optional
[BackendProperties
]) – Properties of a backend to synthesize for (e.g. gate fidelities).pulse_optimize (
Optional
[bool
]) – Whether to optimize pulses during synthesis. A value of None will attempt it but fall back if it doesn’t succeed.natural_direction (
Optional
[bool
]) – Whether to apply synthesis considering directionality of 2qubit gates. Only applies when pulse_optimize == True. 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, raises TranspileError. If set to None, no exception will be raised if a natural direction can not be determined.synth_gates (
Optional
[List
[str
]]) – List of gates to synthesize. If None and pulse_optimize is False or None, default to [‘unitary’]. If None and pulse_optimzie == True, default to [‘unitary’, ‘swap’]

__init__
(basis_gates, approximation_degree=1, coupling_map=None, backend_props=None, pulse_optimize=None, natural_direction=None, synth_gates=None)[source]¶ Synthesize unitaries over some basis gates.
This pass can approximate 2qubit 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.approximation_degree (
float
) – Closeness of approximation (0: lowest, 1: highest).backend_props (
Optional
[BackendProperties
]) – Properties of a backend to synthesize for (e.g. gate fidelities).pulse_optimize (
Optional
[bool
]) – Whether to optimize pulses during synthesis. A value of None will attempt it but fall back if it doesn’t succeed.natural_direction (
Optional
[bool
]) – Whether to apply synthesis considering directionality of 2qubit gates. Only applies when pulse_optimize == True. 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, raises TranspileError. If set to None, no exception will be raised if a natural direction can not be determined.synth_gates (
Optional
[List
[str
]]) – List of gates to synthesize. If None and pulse_optimize is False or None, default to [‘unitary’]. If None and pulse_optimzie == True, default to [‘unitary’, ‘swap’]
Methods
__init__
(basis_gates[, …])Synthesize unitaries over some basis gates.
name
()Return the name of the pass.
run
(dag)Run the UnitarySynthesis pass on dag.
Attributes
Check if the pass is an analysis pass.
Check if the pass is a transformation pass.

property
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.

property
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).

name
()¶ Return the name of the pass.

run
(dag)[source]¶ Run the UnitarySynthesis pass on dag.
 Parameters
dag (
DAGCircuit
) – input dag. Return type
DAGCircuit
 Returns
Output dag with UnitaryGates synthesized to target basis.
 Raises
pulse_optimize is True but pulse optimal decomposition is not known for requested basis. 2. pulse_optimize is True and natural_direction is True but a preferred gate direction can’t be determined from the coupling map or the relative gate lengths.