workbench_algorithms.utils.trotter_utils
Utility functions for Trotterization.
get_ppr_args_from_ham
Convenience to set up PPR arguments from a term in a PauliSum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ham_term
|
tuple
|
A single term in a PauliSum, where the tuple is (coefficient, PauliMask). |
required |
Returns:
| Type | Description |
|---|---|
list
|
The arguments we need to pass. In particular:
|
cmnrs_analytic_bound
Analytic bound for the Trotter error.
Implementation of the "analytic" Trotter error bound in 1711.10980 (see Eqs. 61, 70 therein), with the modification that \(L*\Lambda\) is replaced with the sum of the coefficients of the Hamiltonian.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hamiltonian
|
PauliSum
|
The Hamiltonian for which the number of Trotter steps is to be estimated. |
required |
trotter_error
|
float
|
The allowable Trotter error. |
required |
trotter_order
|
int
|
The order of the Trotterization. |
2
|
Returns:
| Type | Description |
|---|---|
int
|
An upper bound on the number of Trotter steps required to reach precision given by
|
cmnrs_minimized_bound
Calculate the minimized Trotter error commutator bound.
Implementation of the "minimized" Trotter error bound in 1711.10980
(see Eq. 73, 74 therein), by performing binary search over the number
of trotter_steps in _cmnrs_min_func_log.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hamiltonian
|
PauliSum
|
The Hamiltonian for which the number of Trotter steps is to be estimated. |
required |
trotter_error
|
float
|
The allowable Trotter error. |
required |
trotter_order
|
int
|
The order of the Trotterization. Defaults to |
2
|
max_exponent
|
int
|
The maximum exponent over which binary search is to be performed;
i.e. the maximum number of Trotter steps that is returned is bounded by 2^max_exponent.
Defaults to |
100
|
Returns:
| Type | Description |
|---|---|
int
|
An upper bound on the number of Trotter steps required to reach precision given by
|
cmnrs_commutator_1
cmnrs_commutator_1(
hamiltonian,
trotter_error,
max_exponent=100,
verbose=False,
mc=False,
num_trials=100,
)
Commutator bound for first order Trotterization.
Returns the first order commutator bound in 1711.10980, by performing binary search over the number
of trotter_steps in _cmnrs_commutator_func.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hamiltonian
|
PauliSum
|
The Hamiltonian for which the number of Trotter steps is to be estimated. |
required |
trotter_error
|
float
|
The allowable Trotter error. |
required |
max_exponent
|
int
|
The maximum exponent over which binary search is to be performed;
i.e. the maximum number of Trotter steps that is returned is bounded
by 2^max_exponent. Defaults to |
100
|
verbose
|
bool
|
Whether to output possibly useful debugging and timing data. |
False
|
mc
|
bool
|
If |
False
|
num_trials
|
int
|
The number of trials to run if |
100
|
Returns:
| Type | Description |
|---|---|
int
|
An upper bound on the number of Trotter steps required to reach precision given by
|
Note
This bound is only applicable to first order Trotterization.
bounded_num_trotter_steps
Calculates Google's second order commutator bound for Trotterization.
Calculates Eq. (6) from 1902.10673; i.e. returns an upper bound on the number of
Trotter steps needed to reach an allowable error given by trotter_error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hamiltonian
|
PauliSum
|
The Hamiltonian for which the number of Trotter steps is to be estimated. |
required |
trotter_error
|
float
|
The allowable Trotter error. |
required |
verbose
|
bool
|
Whether to output possibly useful debugging and timing data. |
False
|
Returns:
| Type | Description |
|---|---|
int
|
An upper bound on the number of Trotter steps required to reach precision given by
|
Note
This bound is only applicable to second order Trotterization.