qml.estimator.templates.BBQRAM¶
- class BBQRAM(num_bitstrings, size_bitstring, num_wires, num_bit_flips=None, control_wires=None, target_wires=None, work_wires=None)[source]
Bases:
ResourceOperatorResource class for BBQRAM.
- Parameters:
num_bitstrings (int) – the size of the classical memory array to retrieve values from
size_bitstring (int) – the length of the individual bitstrings in the classical memory
num_bit_flips (int) – the number of 1s in the classical memory
num_wires (int) – the number of qubits the operation acts upon
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
bitstringsinto the target register.
- Raises:
ValueError – if the number of wires provided does not match
num_wires
- Resources:
The resources are obtained from the BBQRAM implementation in PennyLane. The original publication of the algorithm can be found in Quantum Random Access Memory.
See also
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'num_bit_flips', 'num_bitstrings', 'num_wires', 'size_bitstring'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
num_wires (int): the number of qubits the operation acts upon
num_bitstrings (int): the size of the classical memory array to retrieve values from
size_bitstring (int): the length of the individual bitstrings in the classical memory
num_bit_flips (int): the number of 1s in the classical memory
- Return type:
dict
Methods
resource_decomp(num_bitstrings, ...)Returns a list representing the resources of the operator.
resource_rep(num_bitstrings, size_bitstring, ...)Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
tracking_name(num_bitstrings, ...)Returns the tracking name built with the operator's parameters.
- classmethod resource_decomp(num_bitstrings, size_bitstring, num_bit_flips, 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_bitstrings (int) – the size of the classical memory array to retrieve values from
size_bitstring (int) – the length of the individual bitstrings in the classical memory
num_bit_flips (int) – the number of 1s in the classical memory
num_wires (int) – the number of qubits the operation acts upon
- Resources:
The resources are obtained from the BBQRAM implementation in PennyLane. The original publication of the algorithm can be found in 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(num_bitstrings, size_bitstring, num_bit_flips, num_wires)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Parameters:
num_bitstrings (int) – the size of the classical memory array to retrieve values from
size_bitstring (int) – the length of the individual bitstrings in the classical memory
num_bit_flips (int) – the number of 1s in the classical memory
num_wires (int) – the number of qubits the operation acts upon
- Returns:
the operator in a compressed representation
- Return type: