qml.estimator.templates.QubitizeTHC

class QubitizeTHC(thc_ham, prep_op=None, select_op=None, coeff_precision=None, rotation_precision=None, wires=None)[source]

Bases: ResourceOperator

Resource class for qubitization of tensor hypercontracted 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 for which the walk operator is being created.

  • prep_op (ResourceOperator | None) – An optional resource operator, corresponding to the prepare routine. If None, the default PrepTHC will be used.

  • select_op (ResourceOperator | None) – An optional resource operator, corresponding to the select routine. If None, the default SelectTHC will be used.

  • coeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles for select_op.

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

Resources:

The resources are calculated based on 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)
>>> prep = qre.PrepTHC(thc_ham, coeff_precision=20, select_swap_depth=2)
>>> res = qre.estimate(qre.QubitizeTHC(thc_ham, prep_op=prep))
>>> print(res)
--- Resources: ---
 Total wires: 381
    algorithmic wires: 68
    allocated wires: 313
         zero state: 313
         any state: 0
 Total gates : 5.628E+4
  'Toffoli': 3.504E+3,
  'CNOT': 4.138E+4,
  'X': 2.071E+3,
  'Z': 41,
  'S': 80,
  'Hadamard': 9.213E+3

Precision Precedence

The coeff_precision and rotation_precision arguments are used to determine the number of bits for loading the coefficients and the rotation angles, respectively. The final value is determined by the following precedence:

  • If provided, the precisions from prep_op and select_op take precedence.

  • If prep_op, and select_op are not provided or have the precision value set to None, the values for coeff_precision, and rotation_precision arguments are used.

  • If both of the above are not specified, the value set in ResourceConfig is used.

resource_keys

resource_params

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

resource_keys = {'prep_op', 'select_op', '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 for which the walk operator is being created.

  • prep_op (CompressedResourceOp | None): An optional compressed resource operator, corresponding to the prepare routine. If None, the default PrepTHC will be used.

  • select_op (CompressedResourceOp | None): An optional compressed resource operator, corresponding to the select routine. If None, the default SelectTHC will be used.

  • coeff_precision (int | None): The number of bits used to represent the precision for loading the coefficients of Hamiltonian.

  • rotation_precision (int | None): The number of bits used to represent the precision for loading the rotation angles.

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[, prep_op, ...])

Returns a list representing the resources of the operator.

resource_rep(thc_ham[, prep_op, select_op, ...])

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 params of the target operator.

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, prep_op=None, select_op=None, coeff_precision=None, rotation_precision=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 for which the walk operator is being created

  • prep_op (CompressedResourceOp | None) – An optional compressed resource operator, corresponding to the prepare routine. If None, the default PrepTHC will be used.

  • select_op (CompressedResourceOp | None) – An optional compressed resource operator, corresponding to the select routine. If None, the default SelectTHC will be used.

  • coeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles for basis rotation.

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, prep_op=None, select_op=None, coeff_precision=None, rotation_precision=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 for which the walk operator is being created.

  • prep_op (CompressedResourceOp | None) – An optional compressed resource operator, corresponding to the prepare routine. If None, the default PrepTHC will be used.

  • select_op (CompressedResourceOp | None) – An optional compressed resource operator, corresponding to the select routine. If None, the default SelectTHC will be used.

  • coeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian.

  • rotation_precision (int | None) – The number of bits used to represent the precision for loading the rotation angles.

Returns:

the operator in a compressed representation

Return type:

CompressedResourceOp

Contents

Using PennyLane

Release news

Development

API

Internals