Skip to main contentIBM Quantum Documentation Mirror

ExactReciprocal

class qiskit.circuit.library.ExactReciprocal(num_state_qubits, scaling, neg_vals=False, name='1/x')

GitHub

Bases: QuantumCircuit

Exact reciprocal

∣x⟩∣0⟩↦cos⁡(1/x)∣x⟩∣0⟩+sin⁡(1/x)∣x⟩∣1⟩|x\rangle |0\rangle \mapsto \cos(1/x)|x\rangle|0\rangle + \sin(1/x)|x\rangle |1\rangle
Deprecated since version 2.2

The class qiskit.circuit.library.arithmetic.exact_reciprocal.ExactReciprocal is deprecated as of Qiskit 2.2. It will be removed in Qiskit 3.0. Use the class qiskit.circuit.library.ExactReciprocalGate instead.

Parameters

  • num_state_qubits (int) – The number of qubits representing the value to invert.
  • scaling (float) – Scaling factor ss of the reciprocal function, i.e. to compute s/xs / x.
  • neg_vals (bool) – Whether xx might represent negative values. In this case the first qubit is the sign, with ∣1⟩|1\rangle for negative and ∣0⟩|0\rangle for positive. For the negative case it is assumed that the remaining string represents 1−x1 - x. This is because e−2πix=e2πi(1−x)e^{-2 \pi i x} = e^{2 \pi i (1 - x)} for x∈[0,1)x \in [0,1).
  • name (str) – The name of the object.
Note

It is assumed that the binary string xx represents a number < 1.


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