Skip to content

Conversation

@alexanderivrii
Copy link
Member

Summary

Part of #13046. Adds the following Gate classes in addition to existing QuantumCircuit classes:

  • AndGate for AND
  • OrGate for OR
  • BitwiseXorGate for XOR
  • InnerProductGate for InnerProduct

Details and comments

To be honest, the difference between an AndGate gate and an AND quantum circuit is rather small. In addition to the general consistency pursued by #13046, it might be just a tiny bit more ergonomic to type
qc.append(AndGate(5), [0, 1, 2, 3, 4, 5]) rather than qc.append(AND(5).to_gate(), [0, 1, 2, 3, 4, 5]), and the first circuit has one less level of nestedness than the second (in the former case it takes one call to decompose to see the definition circuit, and in the latter case - two). This applies to all 4 gates.

Actually, another benefit for AndGate and OrGate is that as their definitions are built on top of MCX gates, we are able to use all the synthesis methods that leverage ancilla qubits via the "mcx" plugin mechanism.

@alexanderivrii alexanderivrii requested a review from a team as a code owner October 16, 2024 11:00
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia

@alexanderivrii alexanderivrii added this to the 1.3.0 milestone Oct 16, 2024
@coveralls
Copy link

coveralls commented Oct 16, 2024

Pull Request Test Coverage Report for Build 11595891469

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 91 of 98 (92.86%) changed or added relevant lines in 6 files are covered.
  • 12 unchanged lines in 5 files lost coverage.
  • Overall coverage increased (+0.02%) to 88.711%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/library/boolean_logic/inner_product.py 15 16 93.75%
qiskit/circuit/library/boolean_logic/quantum_and.py 24 25 96.0%
qiskit/circuit/library/boolean_logic/quantum_or.py 25 26 96.15%
qiskit/circuit/library/boolean_logic/quantum_xor.py 22 26 84.62%
Files with Coverage Reduction New Missed Lines %
qiskit/circuit/library/iqp.py 1 96.15%
crates/accelerate/src/unitary_synthesis.rs 1 92.2%
crates/qasm2/src/expr.rs 1 94.02%
crates/qasm2/src/lex.rs 3 92.48%
crates/qasm2/src/parse.rs 6 97.62%
Totals Coverage Status
Change from base Build 11590598875: 0.02%
Covered Lines: 75593
Relevant Lines: 85213

💛 - Coveralls

@Cryoris Cryoris self-assigned this Oct 17, 2024
Copy link
Collaborator

@Cryoris Cryoris 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 adding this! I left some small comments below 🙂

Copy link
Collaborator

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@Cryoris Cryoris added this pull request to the merge queue Oct 31, 2024
Merged via the queue into Qiskit:main with commit 8a97ef7 Oct 31, 2024
16 checks passed
@ShellyGarion ShellyGarion added the Changelog: New Feature Include in the "Added" section of the changelog label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: New Feature Include in the "Added" section of the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants