qml.estimator.templates.BasisState¶
- class BasisState(num_wires, wires=None)[source]
Bases:
ResourceOperatorResource class for preparing a single basis state.
- Parameters:
num_wires (int) – the number of wires the operator acts on
wires (WiresLike, Optional) – the wire(s) the operation acts on
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'num_wires'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
num_wires (int): number of wires the operator acts on
- Return type:
dict
Methods
resource_decomp(num_wires)Returns a list representing the resources of the operator.
resource_rep(num_wires)Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- classmethod resource_decomp(num_wires)[source]¶
Returns a list representing the resources of the operator. Each object in the list represents a gate and the number of times it occurs in the circuit.
- Parameters:
num_wires (int) – the number of wires the operator acts on
- Returns:
A list of
GateCountobjects, where each object represents a specific quantum gate and the number of times it appears in the decomposition.- Return type:
list[
GateCount]