openfermion.circuits.preprocess_lcu_coefficients_for_reversible_sampling
Prepares data used to perform efficient reversible roulette selection.
openfermion.circuits.preprocess_lcu_coefficients_for_reversible_sampling(
lcu_coefficients, epsilon
)
Treats the coefficients of unitaries in the linear combination of
unitaries decomposition of the Hamiltonian as probabilities in order to
decompose them into a list of alternate and keep numerators allowing for
an efficient preparation method of a state where the computational basis
state :math. |k>
has an amplitude proportional to the coefficient.
It is guaranteed that following the following sampling process will
sample each index k with a probability within epsilon of
lcu_coefficients[k] / sum(lcu_coefficients) and also,
- Uniformly sample an index i from [0, len(lcu_coefficients) - 1].
- With probability keep_numers[i] / by keep_denom, return i.
- Otherwise return alternates[i].
Args |
lcu_coefficients
|
A list of non-negative floats, with the i'th float
corresponding to the i'th coefficient of an LCU decomposition
of the Hamiltonian (in an ordering determined by the caller).
|
epsilon
|
Absolute error tolerance.
|
Returns |
alternates
|
list[int]
A python list of ints indicating alternative
indices that may be switched to after generating a uniform index.
The int at offset k is the alternate to use when the initial index
is k.
|
keep_numers
|
list[int]
A python list of ints indicating the
numerators of the probability that the alternative index should be
used instead of the initial index.
|
sub_bit_precision
|
int
A python int indicating the exponent of the
denominator to divide the items in keep_numers by in order to get
a probability. The actual denominator is 2**sub_bit_precision.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-26 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]