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

x0cos(1/x)x0+sin(1/x)x1|x\rangle |0\rangle \mapsto \cos(1/x)|x\rangle|0\rangle + \sin(1/x)|x\rangle |1\rangle

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 1x1 - x. This is because e2πix=e2πi(1x)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