Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation of qiskit.circuit.classicalfunction (backport #9337) #10921

Merged
merged 1 commit into from
Oct 2, 2023
Merged
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
22 changes: 17 additions & 5 deletions qiskit/circuit/classicalfunction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
========

The classical function compiler provides the necessary tools to map a classical
irreversible functions into quantum circuits. Below is a simple example of
potentially irreversible functions into quantum circuits. Below is a simple example of
how to synthesize a simple boolean function defined using Python into a
QuantumCircuit:

Expand All @@ -34,10 +34,22 @@
def grover_oracle(a: Int1, b: Int1, c: Int1, d: Int1) -> Int1:
return (not a and b and not c and d)

quantum_circuit = grover_oracle.synth()

Following Qiskit's little-endian bit ordering convention, the left-most bit (`a`) is the most
significant bit and the right-most bit (`d`) is the least significant bit. The resulting
quantum_circuit = grover_oracle.synth(registerless=False)
quantum_circuit.draw('text')

a: ──o──
b: ──■──
c: ──o──
d: ──■──
┌─┴─┐
return: ┤ X ├
└───┘

Following Qiskit's little-endian bit ordering convention, the left-most bit (``a``) is the most
significant bit and the right-most bit (``d``) is the least significant bit.

Supplementary Information
=========================
Expand Down
Loading