qrisp.QuantumFloat.exp_shift#

QuantumFloat.exp_shift(shift)[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
Exception

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: ─────
<BLANKLINE>
a.3: ─────

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