qml.estimator.templates.HybridQRAM

class HybridQRAM(data, num_wires, num_select_wires, num_control_wires, control_wires=None, target_wires=None, work_wires=None)[source]

Bases: ResourceOperator

Resource class for HybridQRAM.

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

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

  • num_select_wires (int) – The number of “select” bits taken from control_wires.

  • num_control_wires (int) – The number of control_wires including select and tree control wires.

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

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

  • work_wires (WiresLike) – The additional wires required to funnel the desired entry of bitstrings into the target_wires register. The work_wires register includes the signal, bus, direction, left port and right port wires in that order for a tree of depth \((n-k)\). For more details, consult section 3 of arXiv:2306.03242.

Raises:

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

Resources:

The resources are obtained from the HybridQRAM implementation in PennyLane. Please find more details about the algorithm in Systems Architecture for Quantum Random Access Memory.

See also

HybridQRAM

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', 'num_target_wires'}
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 to retrieve values from

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

  • num_select_wires (int): the number of select wires

  • num_tree_control_wires (int): the number of work_wires minus the number of select wires

Return type:

dict

resource_decomp(data, num_wires, ...)

Returns a list representing the resources of the operator.

resource_rep(data, num_wires, ...)

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

tracking_name(data, num_wires, ...)

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

classmethod resource_decomp(data, num_wires, num_select_wires, num_tree_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 to retrieve values from

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

  • num_select_wires (int) – the number of select wires

  • num_tree_control_wires (int) – the number of work_wires minus the number of select wires

Resources:

The resources are obtained from the HybridQRAM implementation in PennyLane. Please find more details about the algorithm in Systems Architecture for Quantum Random Access Memory.

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, num_select_wires, num_tree_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 to retrieve values from

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

  • num_select_wires (int) – the number of select wires

  • num_tree_control_wires (int) – the number of work_wires minus the number of select wires

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

static tracking_name(data, num_wires, num_select_wires, num_tree_control_wires)[source]

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

Contents

Using PennyLane

Release news

Development

API

Internals