@@ -1799,14 +1799,14 @@ def run(self, high_level_object, coupling_map=None, target=None, qubits=None, **
1799
1799
1800
1800
if data is None or input_qubits is None :
1801
1801
raise TranspilerError (
1802
- "HighLevelSynthesis: problem with the default plugin for annotated operations ."
1802
+ "The AnnotatedSynthesisDefault plugin should receive data and input_qubits via options ."
1803
1803
)
1804
1804
1805
1805
if len (modifiers ) > 0 :
1806
1806
num_ctrl = sum (
1807
1807
mod .num_ctrl_qubits for mod in modifiers if isinstance (mod , ControlModifier )
1808
1808
)
1809
- total_power = sum (mod .power for mod in modifiers if isinstance (mod , PowerModifier ))
1809
+ power = sum (mod .power for mod in modifiers if isinstance (mod , PowerModifier ))
1810
1810
is_inverted = sum (1 for mod in modifiers if isinstance (mod , InverseModifier )) % 2
1811
1811
1812
1812
# The base operation cannot use control qubits as auxiliary qubits.
@@ -1816,7 +1816,7 @@ def run(self, high_level_object, coupling_map=None, target=None, qubits=None, **
1816
1816
# their previous state, so clean qubits remain clean after each for- or while- loop.
1817
1817
annotated_tracker = tracker .copy ()
1818
1818
annotated_tracker .disable (input_qubits [:num_ctrl ]) # do not access control qubits
1819
- if total_power != 0 or is_inverted :
1819
+ if power != 0 or is_inverted :
1820
1820
annotated_tracker .set_dirty (input_qubits )
1821
1821
1822
1822
# First, synthesize the base operation of this annotated operation.
@@ -1844,11 +1844,6 @@ def run(self, high_level_object, coupling_map=None, target=None, qubits=None, **
1844
1844
# a lot of sense to allow this in the future.
1845
1845
synthesized = self ._apply_annotations (synthesized_base_op , operation .modifiers )
1846
1846
1847
- if not isinstance (synthesized , QuantumCircuit ):
1848
- raise TranspilerError (
1849
- "HighLevelSynthesis: problem with the default plugin for annotated operations."
1850
- )
1851
-
1852
1847
return synthesized
1853
1848
1854
1849
return None
@@ -1858,18 +1853,14 @@ def _apply_annotations(circuit: QuantumCircuit, modifiers: list[Modifier]) -> Qu
1858
1853
"""
1859
1854
Applies modifiers to a quantum circuit.
1860
1855
"""
1861
-
1862
- if not isinstance (circuit , QuantumCircuit ):
1863
- raise TranspilerError ("HighLevelSynthesis: incorrect input to 'apply_annotations'." )
1864
-
1865
1856
for modifier in modifiers :
1866
1857
if isinstance (modifier , InverseModifier ):
1867
1858
circuit = circuit .inverse ()
1868
1859
1869
1860
elif isinstance (modifier , ControlModifier ):
1870
1861
if circuit .num_clbits > 0 :
1871
1862
raise TranspilerError (
1872
- "HighLevelSynthesis : cannot control a circuit with classical bits."
1863
+ "AnnotatedSynthesisDefault : cannot control a circuit with classical bits."
1873
1864
)
1874
1865
1875
1866
# Apply the control modifier to each gate in the circuit.
@@ -1901,17 +1892,14 @@ def _apply_annotations(circuit: QuantumCircuit, modifiers: list[Modifier]) -> Qu
1901
1892
1902
1893
if isinstance (circuit , AnnotatedOperation ):
1903
1894
raise TranspilerError (
1904
- "HighLevelSynthesis : failed to synthesize the control modifier."
1895
+ "AnnotatedSynthesisDefault : failed to synthesize the control modifier."
1905
1896
)
1906
1897
1907
1898
elif isinstance (modifier , PowerModifier ):
1908
1899
circuit = circuit .power (modifier .power )
1909
1900
1910
1901
else :
1911
- raise TranspilerError (f"HighLevelSynthesis: Unknown modifier { modifier } ." )
1912
-
1913
- if not isinstance (circuit , QuantumCircuit ):
1914
- raise TranspilerError ("HighLevelSynthesis: incorrect output of 'apply_annotations'." )
1902
+ raise TranspilerError (f"AnnotatedSynthesisDefault: Unknown modifier { modifier } ." )
1915
1903
1916
1904
return circuit
1917
1905
0 commit comments