Overview¶
Each entry gives the arguments, defaults, return value and errors of a call, or the fields of a record with their meaning and unit. The quickstart and the guides show the same calls in context.
Import the Problems and the workflow calls from nwqlib, and the Methods from nwqlib.algorithms. This example finds the smaller eigenvalue of [[2, 1], [1, 2]], whose eigenvalues are 1 and 3:
from nwqlib import Eigenproblem, solve
from nwqlib.algorithms import Lanczos
problem = Eigenproblem(A=[[2.0, 1.0], [1.0, 2.0]])
method = Lanczos(initial_state=[1, 0], krylov_dimension=2)
result = solve(problem, method=method, seed=7)
print(round(result.eigenvalue, 10)) # 1.0
Entries are listed under their defining module, and the import line at the top of each page gives the public import path.
Find an entry by task¶
| Task | Reference | Guide |
|---|---|---|
| Solve a problem and read the answer | Solve, plan and read results | Plan, compare and solve, Choose a problem and output |
| Build inputs from a matrix, Pauli sum, stencil or state | Inputs and input types | Supply inputs |
| Build a molecular Hamiltonian and its reference energies from a geometry | build_gcim_chemistry_problem |
Chemistry inputs and reference energies |
| Plan, compare or estimate before running | Plan, compare and estimate | Plan, compare and solve |
| Count qubits, gates and shots of a Plan | Resource estimates | Estimate resources |
| Rank candidate Plans by shots, width or predicted time | Rank candidate plans | Rank candidate plans |
| Check accuracy or verify a result | Accuracy and verification | Check accuracy and verify a result |
| Choose a backend, check device fit or export OpenQASM | Backends, profiles and export | Choose a backend, Check device fit and run time |
| Run step by step, continue an interrupted run, or reopen saved work | Run step by step, Save and reopen | Run on a backend, Continue an interrupted run, Save, load and reanalyze results |
| Configure a Method and read its Result | Algorithms | The guide in each row of that table |
| Build circuits from subroutines | Subroutines | Compose blocks |
| Pass your own circuit or write a Method | Extending NWQLib | Run your own circuit, Add a method |
Algorithms¶
| Computes | Methods | Reference | Guide |
|---|---|---|---|
| Expectation of a Hermitian observable in a state | ExpectationMethod |
Pauli expectation | Finite Pauli expectation |
| Estimate of the smallest eigenvalue from Chebyshev moments | Lanczos |
Lanczos | Chebyshev Lanczos |
| Eigenphase or energy by phase estimation | QCELS, SPE, RFE, RWPE |
QPE | QPE |
| Estimate of the smallest eigenvalue in a fixed or adaptively grown trial basis | FixedGCIM, ADAPT |
GCiM and ADAPT | GCiM |
Solution of du/dt = -A u + b |
LCHS |
LCHS | LCHS |
Solution of A x = b |
QLS |
QLS | QLS |
| Candidate minimizer of an objective over a box | QHD |
QHD | QHD |
| Candidate minimizer subject to constraints, and box refinement | solve_augmented_lagrangian, refine_box |
QHD constrained problems and box refinement | Constrained problems |
Subroutines¶
| Builds | Reference |
|---|---|
| Block encodings of matrices | Block encoding |
| Linear combinations of unitaries (PREP and SELECT) | LCU |
| Coherent phase-estimation circuits | Coherent QPE |
| QSP and QSVT phases and circuits | QSP and QSVT |
| State preparation circuits, direct or from a matrix product state | State preparation |
| Evolution under a Pauli sum | Hamiltonian evolution |
| Fermionic operator pools and their generator circuits | Fermionic pools |
| Pauli decomposition of a matrix | Pauli decomposition |
| Trotter step counts with error bounds, and Trotter circuits | Trotterization |