qp.labs.estimator_beta.Allocate¶
- class Allocate(num_wires, state=AllocateState.ZERO, restored=False)[source]¶
Bases:
objectA class used to represent the allocation of auxiliary wires to be used in the resource decomposition of a
ResourceOperator.- Parameters:
num_wires (int) – the number of wires to be allocated
state (Literal["any", "zero"] | AllocateState) – The quantum state of the wires to be allocated, valid values include “zero” or “any”.
restored (bool) – A guarantee that the allocated register will be restored (deallocated) to its initial state. If True, this requirement will be enforced programmatically.
- Raises:
ValueError – num_wires must be a positive integer
ValueError – if restored is not a boolean
Example
>>> import pennylane.labs.estimator_beta as qre >>> qre.Allocate(4) Allocate(4, state=zero, restored=False) >>> qre.Allocate(2, state="any", restored=True) Allocate(2, state=any, restored=True)
Attributes
The number of wires to be allocated.
A guarantee that the allocated register will be restored (deallocated) to its initial state.
The quantum state of the wires to be allocated, valid values include "zero" or "any".
- num_wires¶
The number of wires to be allocated.
- restored¶
A guarantee that the allocated register will be restored (deallocated) to its initial state. If True, this requirement will be enforced programmatically.
- state¶
The quantum state of the wires to be allocated, valid values include “zero” or “any”.
Methods