Skip to content

Default optimization level does not perform self-inverse gate cancellations #7016

@nonhermitian

Description

@nonhermitian

Information

  • Qiskit Terra version: latest
  • Python version:
  • Operating system:

What is the current behavior?

qc= QuantumCircuit(2)
qc.h(range(2))
qc.cz(0,1)
qc.draw()
     ┌───┐   
q_0: ┤ H ├─■─
     ├───┤ │ 
q_1: ┤ H ├─■─
     └───┘   
transpile(qc, basis_gates=['h', 'cx']).draw()
     ┌───┐               
q_0: ┤ H ├───────■───────
     ├───┤┌───┐┌─┴─┐┌───┐
q_1: ┤ H ├┤ H ├┤ X ├┤ H ├
     └───┘└───┘└───┘└───┘

Steps to reproduce the problem

What is the expected behavior?

I would expect the default level of optimization to remove trivial things like repeated H gates.

Suggested solutions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions