Skip to content

Conversation

georgios-ts
Copy link
Contributor

Summary

Changes on HoareOptimizer. Resolves #4981.

Details and comments

This PR introduces the following changes on HoareOptimizer.

  • Fixes triviality check condition for CZGate, CU1Gate, MCU1Gate.
    These gates act trivially (up to global phase) iff the clause or together with previous conditions is unsatisfiable.

  • Removes 'always trivial' condition from CRZGate.

  • Catches CircuitError for instructions with no inverse.
    For example, the following code would previously raise an error.

qc = QuantumCircuit(1)
qc.x(0)
qc.measure_all()

pm = PassManager()
pm.append(HoareOptimizer(size=10))
circ = pm.run(qc)
  • Adds another optmization step by removing the control from a Controlled - U (and applies U directly on target qubits) iff all control qubits are in definite |1> state.

@georgios-ts georgios-ts requested a review from a team as a code owner September 26, 2020 13:41
georgios-ts and others added 2 commits September 26, 2020 16:48
Co-authored-by: Abby Mitchell <abby.mitchell@btinternet.com>
@1ucian0
Copy link
Member

1ucian0 commented Oct 9, 2020

While reviewing this PR with @javabster, we noticed that the qiskit/transpiler/passes/optimization/_gate_extension.py docstring was a bit twisted. @georgios-ts, hope you dont mind we pushed a change in this branch ( 126b955 ) with, what we think, is a better docstring.

Co-authored-by: Luciano Bello <luciano.bello@ibm.com>
Co-authored-by: Luciano Bello <luciano.bello@ibm.com>
@CLAassistant
Copy link

CLAassistant commented Feb 9, 2021

CLA assistant check
All committers have signed the CLA.

ajavadia
ajavadia previously approved these changes Jun 12, 2021
Copy link
Member

@ajavadia ajavadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix, please also add a bugfix release note

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HoareOptimizer does not handle CZ correctly
4 participants