qml.estimator.templates.PrepTHC¶
- class PrepTHC(thc_ham, coeff_precision=None, select_swap_depth=None, wires=None)[source]
Bases:
ResourceOperator
Resource class for preparing the state for tensor hypercontracted (THC) Hamiltonian.
This operator customizes the Prepare circuit based on the structure of THC Hamiltonian.
- Parameters:
thc_ham (
THCHamiltonian
) – a tensor hypercontracted Hamiltonian for which the state is being preparedcoeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian. If
None
is provided, the default value from theResourceConfig
is used.select_swap_depth (int | None) – A parameter of
QROM
used to trade-off extra wires for reduced circuit depth. Defaults toNone
, which internally determines the optimal depth.wires (WiresLike | None) – the wires on which the operator acts
- Resources:
The resources are calculated based on Figures 3 and 4 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.PrepTHC(thc_ham, coeff_precision=15)) >>> print(res) --- Resources: --- Total wires: 185 algorithmic wires: 12 allocated wires: 173 zero state: 28 any state: 145 Total gates : 1.485E+4 'Toffoli': 467, 'CNOT': 1.307E+4, 'X': 512, 'Hadamard': 797
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- resource_keys = {'coeff_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 for which the state is being preparedcoeff_precision (int | None): The number of bits used to represent the precision for loading the coefficients of Hamiltonian. If
None
is provided, the default value from theResourceConfig
is used.select_swap_depth (int | None): A parameter of
QROM
used to trade-off extra wires for reduced circuit depth. Defaults toNone
, which internally determines the optimal depth.
- Return type:
dict
Methods
adjoint_resource_decomp
(target_resource_params)Returns a list representing the resources of the adjoint of the operator.
resource_decomp
(thc_ham[, coeff_precision, ...])Returns a list representing the resources of the operator.
resource_rep
(thc_ham[, coeff_precision, ...])Returns a compressed representation containing only the parameters of the Operator that are needed to compute a resource estimation.
- classmethod adjoint_resource_decomp(target_resource_params)[source]¶
Returns a list representing the resources of the adjoint of the operator. Each object represents a quantum gate and the number of times it occurs in the decomposition.
- Parameters:
thc_ham (
THCHamiltonian
) – a tensor hypercontracted Hamiltonian for which the walk operator is being createdtarget_resource_params (dict) – A dictionary containing the resource parameters of the target operator.
- Resources:
The resources are calculated based on Figures 3 and 4 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, coeff_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.
- Parameters:
thc_ham (
THCHamiltonian
) – a tensor hypercontracted Hamiltonian for which the walk operator is being createdcoeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian. If
None
is provided, the default value from theResourceConfig
is used.select_swap_depth (int | None) – A parameter of
QROM
used to trade-off extra qubits for reduced circuit depth. Defaults toNone
, which internally determines the optimal depth.
- Resources:
The resources are calculated based on Figures 3 and 4 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_rep(thc_ham, coeff_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 for which the state is being preparedcoeff_precision (int | None) – The number of bits used to represent the precision for loading the coefficients of Hamiltonian. If
None
is provided, the default value from theResourceConfig
is used.select_swap_depth (int | None) – A parameter of
QROM
used to trade-off extra wires for reduced circuit depth. Defaults toNone
, which internally determines the optimal depth.
- Returns:
the operator in a compressed representation
- Return type: