qp.labs.estimator_beta.templates.LabsSumOfSlatersPrep¶
- class LabsSumOfSlatersPrep(num_coeffs, num_wires, num_bits=None, stateprep_op=None, select_swap_depth=None, wires=None)[source]¶
Bases:
ResourceOperatorResource class for preparing an initial state with the sum-of-Slaters technique.
The operation prepares an arbitrary state
\[|\psi\rangle = \sum_{l \in L} c_l |l \rangle\]- Parameters:
num_coeffs (int) – number of coefficients of the sparse state to prepare.
num_wires (int) – number of wires on which the state is being prepared.
num_bits (int | None) – number of bits that is sufficient to uniquely identify every Slater determinant in the target state, as defined in Sec. III A of Fomichev et al., PRX Quantum 5, 040339.
stateprep_op (ResourceOperator | None) – An optional argument to set the subroutine used to perform the condensed state preparation. If
Noneis provided, the resources will be computed assuming the condensed state preparation is performed usingLabsMottonenStatePreparation.select_swap_depth (int | None) – A parameter of
LabsQROMused to trade-off extra qubits for reduced circuit depth.wires (WiresLike | None) – the wires the operation acts on
- Resources:
The resources were obtained from Sec. III A of Fomichev et al., PRX Quantum 5, 040339.
See also
Example
The resources for this operation are computed using:
>>> import pennylane.labs.estimator_beta as qre >>> sos_state = qre.SumOfSlatersPrep(num_coeffs=100, num_wires=10) >>> print(qre.estimate(sos_state)) --- Resources: --- Total wires: 32 algorithmic wires: 10 allocated wires: 22 zero state: 22 any state: 0 Total gates : 2.909E+4 'Toffoli': 949, 'T': 2.231E+4, 'CNOT': 2.204E+3, 'X': 1.107E+3, 'Hadamard': 2.520E+3
Attributes
Returns a dictionary containing the minimal information needed to compute the resources.
- num_wires = None¶
- resource_keys = {'num_bits', 'num_coeffs', 'num_wires', 'select_swap_depth', 'stateprep_cmpr_op'}¶
- resource_params¶
Returns a dictionary containing the minimal information needed to compute the resources.
- Returns:
- A dictionary containing the resource parameters:
num_coeffs(int): number of coefficients of the sparse state to prepare
num_wires (int): the number of wires that the state is being prepared on
num_bits (int | None): number of bits that is sufficient to uniquely identify every Slater determinant in the target state, as defined in Sec. III A of Fomichev et al., PRX Quantum 5, 040339.
stateprep_cmpr_op (
CompressedResourceOp| None): An optional argument to set the subroutine used to perform the condensed state preparation. IfNoneis provided, the resources will be computed assuming the condensed state preparation is performed usingLabsMottonenStatePreparation.select_swap_depth (int | None): A parameter of
QROMused to trade-off extra qubits for reduced circuit depth.
- Return type:
dict
Methods
add_parallel(other)Adds a
ResourceOperatororResourcesin parallel.add_series(other)Adds a
ResourceOperatororResourcesin series.adjoint_resource_decomp([target_resource_params])Returns a list representing the resources for the adjoint of the operator.
controlled_resource_decomp(num_ctrl_wires, ...)Returns a list representing the resources for a controlled version of the operator.
pow_resource_decomp(pow_z[, ...])Returns a list representing the resources for an operator raised to a power.
queue([context])Append the operator to the Operator queue.
resource_decomp(num_coeffs, num_wires[, ...])Returns a list representing the resources of the operator.
resource_rep(num_coeffs, num_wires[, ...])Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
Returns a compressed representation directly from the operator
tracking_name(*args, **kwargs)Returns a name used to track the operator during resource estimation.
- add_parallel(other)¶
Adds a
ResourceOperatororResourcesin parallel.- Parameters:
other (
ResourceOperator) – The other object to combine with, it can be anotherResourceOperatoror aResourcesobject.- Returns:
added
Resources- Return type:
Resources
- add_series(other)¶
Adds a
ResourceOperatororResourcesin series.- Parameters:
other (
ResourceOperator) – The other object to combine with, it can be anotherResourceOperatoror aResourcesobject.- Returns:
added
Resources- Return type:
Resources
- classmethod adjoint_resource_decomp(target_resource_params=None)¶
Returns a list representing the resources for the adjoint of the operator.
For a
ResourceOperatorthat doesn’t define anadjoint_resource_decompmethod, this will be the defaultadjoint_resource_decompmethod.- Resources:
The resources for the adjoint of an operator are obtained by tracking the adjoint of each gate in the resource decomposition of the operator.
- Parameters:
target_resource_params (dict | None) – A dictionary containing the resource parameters of the target operator.
- classmethod controlled_resource_decomp(num_ctrl_wires, num_zero_ctrl, target_resource_params=None)¶
Returns a list representing the resources for a controlled version of the operator.
For a
ResourceOperatorthat doesn’t define acontrolled_resource_decompmethod, this will be the defaultcontrolled_resource_decompmethod.- Resources:
The resources for the controlled operator are obtained by controlling (with the same number of control wires and zero controlled values) each gate in the base operator’s resource decomposition.
- Parameters:
num_ctrl_wires (int) – the number of qubits the operation is controlled on
num_zero_ctrl (int) – the number of control qubits, that are controlled when in the \(|0\rangle\) state
target_resource_params (dict | None) – A dictionary containing the resource parameters of the target operator.
- classmethod pow_resource_decomp(pow_z, target_resource_params=None)¶
Returns a list representing the resources for an operator raised to a power.
For a
ResourceOperatorthat doesn’t define apow_resource_decompmethod, this will be itspow_resource_decompmethod.- Resources:
The resources for an operator raised to some power are obtained by taking the base resource decomposition of the operator and tracking each gate raised to the given power. For a power of zero, the identity operator is returned. For a power of one, the base operator is returned.
- Parameters:
pow_z (int) – exponent that the operator is raised to
target_resource_params (dict | None) – A dictionary containing the resource parameters of the target operator.
- queue(context=<class 'pennylane.queuing.QueuingManager'>)¶
Append the operator to the Operator queue.
- classmethod resource_decomp(num_coeffs, num_wires, num_bits=None, stateprep_cmpr_op=None, select_swap_depth=None)[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_coeffs (int) – number of coefficients of the sparse state to prepare
num_wires (int) – the number of wires the state is being prepared on
num_bits (int | None) – number of bits that is sufficient to uniquely identify every Slater determinant in the target state, as defined in Sec. III A of Fomichev et al., PRX Quantum 5, 040339.
stateprep_cmpr_op (
CompressedResourceOp| None) – An optional argument to set the subroutine used to perform the condensed state preparation. IfNoneis provided, the resources will be computed assuming the condensed state preparation is performed usingLabsMottonenStatePreparation.select_swap_depth (int | None) – A parameter of
LabsQROMused to trade-off extra qubits for reduced circuit depth.
- Resources:
The resources were obtained from Sec. III A of Fomichev et al., PRX Quantum 5, 040339.
- Returns:
A list of
GateCountobjects, 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_coeffs, num_wires, num_bits=None, stateprep_cmpr_op=None, select_swap_depth=None)[source]¶
Returns a compressed representation containing only the parameters of the Operator that are needed to compute the resources.
- Returns:
the operator in a compressed representation
- Return type:
- resource_rep_from_op()¶
Returns a compressed representation directly from the operator
- classmethod tracking_name(*args, **kwargs)¶
Returns a name used to track the operator during resource estimation.