InnerProduct
class qiskit.circuit.library.InnerProduct(num_qubits)
Bases: QuantumCircuit
A 2n-qubit Boolean function that computes the inner product of two n-qubit vectors over .
This implementation is a phase oracle which computes the following transform.
The corresponding unitary is a diagonal, which induces a -1 phase on any inputs where the inner product of the top and bottom registers is 1. Otherwise it keeps the input intact.
q0_0: ─■──────────
│
q0_1: ─┼──■───────
│ │
q0_2: ─┼──┼──■────
│ │ │
q0_3: ─┼──┼──┼──■─
│ │ │ │
q1_0: ─■──┼──┼──┼─
│ │ │
q1_1: ────■──┼──┼─
│ │
q1_2: ───────■──┼─
│
q1_3: ──────────■─
Reference Circuit:

Return a circuit to compute the inner product of 2 n-qubit registers.
The class qiskit.circuit.library.boolean_logic.inner_product.InnerProduct
is deprecated as of Qiskit 2.1. It will be removed in Qiskit 3.0. Use qiskit.circuit.library.InnerProductGate instead.
Parameters
num_qubits (int) – width of top and bottom registers (half total circuit width)
Attributes
name
Type: str
A human-readable name for the circuit.
Example
from qiskit import QuantumCircuit
qc = QuantumCircuit(2, 2, name="my_circuit")
print(qc.name)
my_circuit