qrisp.unlock#

unlock(qubits)[source]#

Reverses the effect of “lock”.

Parameters
qubitslist[Qubit] or QuantumVariable

The list of Qubits to lock.

Examples

We create a QuantumChar, lock it’s Qubits and attempt to initialize.

>>> from qrisp import QuantumChar, lock, unlock
>>> q_ch = QuantumChar()
>>> lock(q_ch)
>>> q_ch[:] = "g"
Exception: Tried to perform operations on locked qubits

We now unlock and try again

>>> unlock(q_ch)
>>> q_ch[:] = "g"
>>> print(q_ch)
{'g': 1.0}