Skip to content

Commit

Permalink
Remove dead code branch from Optimize1qDecomposition Python code (#…
Browse files Browse the repository at this point in the history
…13188)

Since 8e5fab6 (gh-12959), this branch has been dead, and the Rust
method alluded to in it (`compute_error_one_qubit_sequence`) was
removed.  This is occasionally - but for some reason not always -
detected by `pylint`, and it's a true error so should be removed.

In fact, almost all of the Python code in `Optimize1qDecomposition` is
dead from the perspective of that transpiler pass.  However,
`Optimize1qCommutation` has no concept of safe API boundaries, and is in
fact still using all of these methods (and the default
`UnitarySynthesis` plugin does a little too).  A follow-up commit can
reorganise the code to fix this, but this commit is intended to be
mergeable faster, to unblock a couple of PRs that are triggering the
pylint failure.
  • Loading branch information
jakelishman committed Sep 19, 2024
1 parent ece25b6 commit 3100993
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,12 @@ def run(self, dag):
def _error(self, circuit, qubit):
"""
Calculate a rough error for a `circuit` that runs on a specific
`qubit` of `target` (`circuit` can either be an OneQubitGateSequence
from Rust or a list of DAGOPNodes).
`qubit` of `target` (`circuit` is a list of DAGOPNodes).
Use basis errors from target if available, otherwise use length
of circuit as a weak proxy for error.
"""
if isinstance(circuit, euler_one_qubit_decomposer.OneQubitGateSequence):
return euler_one_qubit_decomposer.compute_error_one_qubit_sequence(
circuit, qubit, self.error_map
)
else:
return euler_one_qubit_decomposer.compute_error_list(circuit, qubit, self.error_map)
return euler_one_qubit_decomposer.compute_error_list(circuit, qubit, self.error_map)


def _possible_decomposers(basis_set):
Expand Down

0 comments on commit 3100993

Please sign in to comment.