qrisp.QuantumFloat.exp_shift#

QuantumFloat.exp_shift(shift: int) None[source]#

Performs an internal bit shift.

Note that this method doesn’t cost any quantum gates. For the quantum version of this method, see quantum_bit_shift.

Parameters:
shiftint

The amount to shift.

Raises:
TypeError

Tried to shift QuantumFloat exponent by non-integer value

Examples

We create a QuantumFloat and perform a bitshift:

>>> from qrisp import QuantumFloat
>>> a = QuantumFloat(4)
>>> a[:] = 2
>>> a.exp_shift(2)
>>> print(a)
{8: 1.0}
>>> print(a.qs)
QuantumCircuit:
---------------
a.0: ─────
     β”Œβ”€β”€β”€β”
a.1: ─ X β”œ
     β””β”€β”€β”€β”˜
a.2: ─────

a.3: ─────

Live QuantumVariables:
----------------------
QuantumFloat a