qml.estimator.templates.BasisState

class BasisState(num_wires, wires=None)[source]

Bases: ResourceOperator

Resource 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

resource_keys

resource_params

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

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 GateCount objects, where each object represents a specific quantum gate and the number of times it appears in the decomposition.

Return type:

list[GateCount]

classmethod resource_rep(num_wires)[source]

Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

Contents

Using PennyLane

Release news

Development

API

Internals