openfermion.linalg.get_linear_qubit_operator_diagonal
Return a linear operator's diagonal elements.
openfermion.linalg.get_linear_qubit_operator_diagonal(
qubit_operator, n_qubits=None
)
The main motivation is to use it for Davidson's algorithm, to find out the
lowest n eigenvalues and associated eigenvectors.
Qubit terms with X or Y operators will contribute nothing to the diagonal
elements, while I or Z will contribute a factor of 1 or -1 together with
the coefficient.
Args |
qubit_operator
|
QubitOperator
A qubit operator.
|
Returns |
linear_operator_diagonal
|
numpy.ndarray
The diagonal elements for
LinearQubitOperator(qubit_operator).
|
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.
[[["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."],[],[]]