qml.estimator.templates.SelectTHC

class SelectTHC(thc_ham, rotation_precision=None, select_swap_depth=None, wires=None)[source]

Bases: ResourceOperator

Resource class for creating the custom Select operator for tensor hypercontracted (THC) Hamiltonian.

Note

This decomposition assumes that an appropriately sized phase gradient state is available. Users should ensure that the cost of constructing this state has been accounted for. See also PhaseGradient.

Parameters:
  • thc_ham (THCHamiltonian) – A tensor hypercontracted Hamiltonian on which the select operator is being applied.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles for basis rotation. If None is provided, the default value from the ResourceConfig is used.

  • select_swap_depth (int | None) – A parameter of QROM used to trade-off extra wires for reduced circuit depth. Defaults to None, which internally determines the optimal depth.

  • wires (WiresLike | None) – the wires on which the operator acts

Resources:

The resources are calculated based on Figure 5 in arXiv:2011.03494

Example

The resources for this operation are computed using:

>>> import pennylane.estimator as qre
>>> thc_ham =  qre.THCHamiltonian(num_orbitals=20, tensor_rank=40)
>>> res = qre.estimate(qre.SelectTHC(thc_ham, rotation_precision=15))
>>> print(res)
--- Resources: ---
 Total wires: 371
    algorithmic wires: 58
    allocated wires: 313
         zero state: 313
         any state: 0
 Total gates : 1.959E+4
  'Toffoli': 2.219E+3,
  'CNOT': 1.058E+4,
  'X': 268,
  'Z': 41,
  'S': 80,
  'Hadamard': 6.406E+3

resource_keys

resource_params

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

resource_keys = {'rotation_precision', 'select_swap_depth', 'thc_ham'}
resource_params

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

Returns:

A dictionary containing the resource parameters:
  • thc_ham (THCHamiltonian): a tensor hypercontracted Hamiltonian on which the select operator is being applied

  • rotation_precision (int | None): The number of bits used to represent the precision for loading the rotation angles for basis rotation. If None is provided, the default value from the ResourceConfig is used.

  • select_swap_depth (int | None): A parameter of QROM used to trade-off extra wires for reduced circuit depth. Defaults to None, which internally determines the optimal depth.

Return type:

dict

controlled_resource_decomp(num_ctrl_wires, ...)

Returns a list representing the resources for the controlled version of the operator.

resource_decomp(thc_ham[, ...])

Returns a list representing the resources of the operator.

resource_rep(thc_ham[, rotation_precision, ...])

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

classmethod controlled_resource_decomp(num_ctrl_wires, num_zero_ctrl, target_resource_params)[source]

Returns a list representing the resources for the controlled version of the operator.

Note

This decomposition assumes that an appropriately sized phase gradient state is available. Users should ensure that the cost of constructing this state has been accounted for. See also PhaseGradient.

Parameters:
  • num_ctrl_wires (int) – the number of wires the operation is controlled on

  • num_zero_ctrl (int) – the number of control wires, that are controlled when in the \(|0\rangle\) state

  • target_resource_params (dict) – A dictionary containing the resource parameters of the target operator.

Resources:

The resources are calculated based on Figure 5 in arXiv:2011.03494

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_decomp(thc_ham, rotation_precision=None, select_swap_depth=None)[source]

Returns a list representing the resources of the operator. Each object represents a quantum gate and the number of times it occurs in the decomposition.

Note

This decomposition assumes that an appropriately sized phase gradient state is available. Users should ensure that the cost of constructing this state has been accounted for. See also PhaseGradient.

Parameters:
  • thc_ham (THCHamiltonian) – A tensor hypercontracted Hamiltonian on which the select operator is being applied.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles for basis rotation. If None is provided, the default value from the ResourceConfig is used.

  • select_swap_depth (int | None) – A parameter of QROM used to trade-off extra wires for reduced circuit depth. Defaults to None, which internally determines the optimal depth.

Resources:

The resources are calculated based on Figure 5 in arXiv:2011.03494. The resources are modified to remove the control from the Select operation.

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(thc_ham, rotation_precision=None, select_swap_depth=None)[source]

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

Parameters:
  • thc_ham (THCHamiltonian) – A tensor hypercontracted Hamiltonian on which the select operator is being applied.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles for basis rotation. If None is provided, the default value from the ResourceConfig is used.

  • select_swap_depth (int | None) – A parameter of QROM used to trade-off extra wires for reduced circuit depth. Defaults to None, which internally determines the optimal depth.

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

Contents

Using PennyLane

Release news

Development

API

Internals