qrisp.QuantumVariable.extend#
- QuantumVariable.extend(amount, position=-1)[source]#
This method is used to add more qubits to the QuantumVariable. Using the position keyword it is possible to specify the position where the qubits should be added. By default, the qubits are added at the end.
- Parameters:
- amountint
The amount of qubits to add.
- positionint, optional
The position of where to add the qubits. By default, qubits are added at the end. st of qubits which are to be added to the QuantumVariable. The default is None.
- Returns:
- None.
- Raises:
- Exception
Missmatch between proposed qubits and amount integer.
Examples
We create a QuantumVariable and extend it with some extra qubits.
>>> from qrisp import QuantumVariable >>> qv = QuantumVariable(3) >>> print(qv.reg) [Qubit(qv.0), Qubit(qv.1), Qubit(qv.2)] >>> qv.extend(3) >>> print(qv.reg) [Qubit(qv.0), Qubit(qv.1), Qubit(qv.2), Qubit(qv.6), Qubit(qv.6), Qubit(qv.6)]