qml.estimator.templates.SelectOnlyQRAM

class SelectOnlyQRAM(data, num_wires, num_control_wires, num_select_wires, control_wires=None, target_wires=None, select_wires=None, select_value=None)[source]

Bases: ResourceOperator

Resource class for SelectOnlyQRAM.

Parameters:
  • data (TensorLike | Sequence[str]) – The classical memory array to retrieve values from.

  • num_wires (int) – The number of qubits the operation acts upon.

  • num_control_wires (int) – The number of control_wires.

  • num_select_wires (int) – The number of select_wires.

  • control_wires (WiresLike, optional) – The register that stores the index for the entry of the classical data we want to access.

  • target_wires (WiresLike, optional) – The register in which the classical data gets loaded. The size of this register must equal each bitstring length in bitstrings.

  • select_wires (WiresLike, optional) – Wires used to perform the selection.

  • select_value (int, optional) – If provided, only entries whose select bits match this value are loaded. The select_value must be an integer in \([0, 2^{\texttt{len(select_wires)}}]\), and cannot be used if no select_wires are provided.

Raises:

ValueError – if the number of wires provided does not match num_wires

Resources:

The resources are obtained from the SelectOnlyQRAM implementation in PennyLane.

See also

SelectOnlyQRAM

resource_keys

resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

resource_keys = {'data', 'num_control_wires', 'num_select_wires', 'select_value'}
resource_params

Returns a dictionary containing the minimal information needed to compute the resources.

Returns:

A dictionary containing the resource parameters:
  • data (TensorLike | Sequence[str]): the classical memory array to retrieve values from

  • num_wires (int): the number of qubits the operation acts upon

  • select_value (int or None): if provided, only entries whose select bits match this value are loaded

  • num_select_wires (int): the number of select_wires

  • num_control_wires (int): the number of control_wires

Return type:

dict

resource_decomp(data, num_wires, ...)

Returns a list representing the resources of the operator.

resource_rep(data, num_wires, select_value, ...)

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

tracking_name(data, num_wires, select_value, ...)

Returns the tracking name built with the operator's parameters.

classmethod resource_decomp(data, num_wires, select_value, num_select_wires, num_control_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:
  • data (TensorLike | Sequence[str]) – the classical memory array to retrieve values from

  • num_wires (int) – the number of qubits the operation acts upon

  • select_value (int or None) – if provided, only entries whose select bits match this value are loaded

  • num_select_wires (int) – the number of select_wires

  • num_control_wires (int) – the number of control_wires

Resources:

The resources are obtained from the SelectOnlyQRAM implementation in PennyLane.

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(data, num_wires, select_value, num_select_wires, num_control_wires)[source]

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

Parameters:
  • data (TensorLike | Sequence[str]) – the classical memory array to retrieve values from

  • num_wires (int) – the number of qubits the operation acts upon

  • select_value (int or None) – if provided, only entries whose select bits match this value are loaded

  • num_select_wires (int) – the number of select_wires

  • num_control_wires (int) – the number of control_wires

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

static tracking_name(data, num_wires, select_value, num_select_wires, num_control_wires)[source]

Returns the tracking name built with the operator’s parameters.

Contents

Using PennyLane

Release news

Development

API

Internals