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

Adding new arithmetic gates to toctree (backport #13418) #13429

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
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
47 changes: 37 additions & 10 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
circuit.append(gate, [0, 1, 4, 2, 3])
circuit.draw('mpl')

The library is organized in several sections. The function
The library is organized in several sections. The function
:func:`.get_standard_gate_name_mapping` allows you to see the available standard gates and operations.

.. autofunction:: get_standard_gate_name_mapping
Expand Down Expand Up @@ -221,10 +221,10 @@
OrGate
XOR
BitwiseXorGate
random_bitwise_xor
InnerProduct
InnerProductGate

.. autofunction:: random_bitwise_xor

Basis Change Circuits
=====================
Expand Down Expand Up @@ -280,6 +280,9 @@
CDKMRippleCarryAdder
VBERippleCarryAdder
WeightedAdder
ModularAdderGate
HalfAdderGate
FullAdderGate

Multipliers
-----------
Expand All @@ -290,6 +293,7 @@

HRSCumulativeMultiplier
RGQFTMultiplier
MultiplierGate

Comparators
-----------
Expand Down Expand Up @@ -321,29 +325,40 @@
Particular Quantum Circuits
===========================

The following gates and quantum circuits define specific
quantum circuits of interest:

.. autosummary::
:toctree: ../stubs/
:template: autosummary/class_no_inherited_members.rst

FourierChecking
fourier_checking
GraphState
GraphStateGate
HiddenLinearFunction
hidden_linear_function
IQP
iqp
random_iqp
QuantumVolume
quantum_volume
PhaseEstimation
phase_estimation
GroverOperator
grover_operator
PhaseOracle
PauliEvolutionGate
HamiltonianGate
UnitaryOverlap

For circuits that have a well-defined structure it is preferrable
to use the following functions to construct them:

.. autosummary::
:toctree: ../stubs/
:template: autosummary/class_no_inherited_members.rst

fourier_checking
hidden_linear_function
iqp
random_iqp
quantum_volume
phase_estimation
grover_operator
unitary_overlap


Expand All @@ -362,6 +377,7 @@
real_amplitudes
pauli_two_design
excitation_preserving
qaoa_ansatz
hamiltonian_variational_ansatz
evolved_operator_ansatz

Expand All @@ -386,7 +402,7 @@
Data encoding circuits
======================

The following functions return a parameterized :class:`.QuantumCircuit` to use as data
The following functions return a parameterized :class:`.QuantumCircuit` to use as data
encoding circuits in a series of variational quantum algorithms:

.. autosummary::
Expand All @@ -407,6 +423,17 @@
PauliFeatureMap
ZFeatureMap
ZZFeatureMap


Data preparation circuits
=========================

The following operations are used for state preparation:

.. autosummary::
:toctree: ../stubs/
:template: autosummary/class_no_inherited_members.rst

StatePreparation
Initialize

Expand Down
10 changes: 5 additions & 5 deletions qiskit/circuit/library/arithmetic/adders/adder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class Adder(QuantumCircuit):
r"""Compute the sum of two equally sized qubit registers.

For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
adder performs the following operation

.. math::
Expand Down Expand Up @@ -74,7 +74,7 @@ def num_state_qubits(self) -> int:
class HalfAdderGate(Gate):
r"""Compute the sum of two equally-sized qubit registers, including a carry-out bit.

For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
adder performs the following operation

.. math::
Expand Down Expand Up @@ -120,7 +120,7 @@ def num_state_qubits(self) -> int:
class ModularAdderGate(Gate):
r"""Compute the sum modulo :math:`2^n` of two :math:`n`-sized qubit registers.

For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
adder performs the following operation

.. math::
Expand Down Expand Up @@ -166,12 +166,12 @@ def num_state_qubits(self) -> int:
class FullAdderGate(Gate):
r"""Compute the sum of two :math:`n`-sized qubit registers, including carry-in and -out bits.

For two registers :math:`|a\rangle_n` and :math:|b\rangle_n` with :math:`n` qubits each, an
For two registers :math:`|a\rangle_n` and :math:`|b\rangle_n` with :math:`n` qubits each, an
adder performs the following operation

.. math::

|c_{\text{in}\rangle_1 |a\rangle_n |b\rangle_n
|c_{\text{in}}\rangle_1 |a\rangle_n |b\rangle_n
\mapsto |a\rangle_n |c_{\text{in}} + a + b \rangle_{n + 1}.

The quantum register :math:`|a\rangle_n` (and analogously :math:`|b\rangle_n`)
Expand Down