Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@
"ry": RYGate,
"rz": RZGate,
"r": RGate,
"sx": SXGate,
"x": XGate,
"sx": SXGate(),
"x": XGate(),
}

PARAMETER_FREE_GATE_NAMES = {"x", "sx"}


class Optimize1qGatesDecomposition(TransformationPass):
"""Optimize chains of single-qubit gates by combining them into a single gate.
Expand Down Expand Up @@ -146,7 +148,10 @@ def _gate_sequence_to_dag(self, best_synth_circuit):
out_dag.global_phase = best_synth_circuit.global_phase

for gate_name, angles in best_synth_circuit:
out_dag.apply_operation_back(NAME_MAP[gate_name](*angles), qubits, check=False)
if gate_name in PARAMETER_FREE_GATE_NAMES:
out_dag.apply_operation_back(NAME_MAP[gate_name], qubits, check=False)
else:
out_dag.apply_operation_back(NAME_MAP[gate_name](*angles), qubits, check=False)
return out_dag

def _substitution_checks(self, dag, old_run, new_circ, basis, qubit):
Expand Down