nwqlib 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. nwqlib/__init__.py +63 -0
  2. nwqlib/__main__.py +5 -0
  3. nwqlib/_choice_archive.py +768 -0
  4. nwqlib/_counts.py +168 -0
  5. nwqlib/_limits.py +11 -0
  6. nwqlib/_linalg_laws.py +243 -0
  7. nwqlib/_numerics.py +288 -0
  8. nwqlib/_optional.py +13 -0
  9. nwqlib/_phase_product.py +119 -0
  10. nwqlib/_preparation_laws.py +93 -0
  11. nwqlib/_prepared_execution.py +5346 -0
  12. nwqlib/_projected_eigensolver.py +442 -0
  13. nwqlib/_qpy_archive.py +270 -0
  14. nwqlib/_quantum_readout.py +1071 -0
  15. nwqlib/_remote_preparation.py +200 -0
  16. nwqlib/_run_archive.py +1035 -0
  17. nwqlib/_run_journal.py +575 -0
  18. nwqlib/_sqlite_bytes.py +8 -0
  19. nwqlib/_validation.py +477 -0
  20. nwqlib/algorithms/__init__.py +68 -0
  21. nwqlib/algorithms/_eigen_inputs.py +494 -0
  22. nwqlib/algorithms/_eigen_support.py +178 -0
  23. nwqlib/algorithms/authoring.py +175 -0
  24. nwqlib/algorithms/expectation.py +2938 -0
  25. nwqlib/algorithms/expectation_metadata.py +37 -0
  26. nwqlib/algorithms/gcim/__init__.py +39 -0
  27. nwqlib/algorithms/gcim/adapt.py +1315 -0
  28. nwqlib/algorithms/gcim/adapt_acquisition.py +2547 -0
  29. nwqlib/algorithms/gcim/adapt_actions.py +264 -0
  30. nwqlib/algorithms/gcim/adapt_archive.py +349 -0
  31. nwqlib/algorithms/gcim/adapt_inputs.py +1049 -0
  32. nwqlib/algorithms/gcim/adapt_records.py +643 -0
  33. nwqlib/algorithms/gcim/adapt_verification.py +749 -0
  34. nwqlib/algorithms/gcim/chemistry.py +793 -0
  35. nwqlib/algorithms/gcim/fixed_basis.py +2447 -0
  36. nwqlib/algorithms/gcim/optimization.py +452 -0
  37. nwqlib/algorithms/gcim/pair_reducer.py +336 -0
  38. nwqlib/algorithms/gcim/pencil.py +229 -0
  39. nwqlib/algorithms/gcim/sector.py +132 -0
  40. nwqlib/algorithms/lanczos/__init__.py +12 -0
  41. nwqlib/algorithms/lanczos/archive.py +78 -0
  42. nwqlib/algorithms/lanczos/method.py +1217 -0
  43. nwqlib/algorithms/lanczos/numerical.py +908 -0
  44. nwqlib/algorithms/lanczos/readout.py +490 -0
  45. nwqlib/algorithms/lanczos/records.py +339 -0
  46. nwqlib/algorithms/lanczos/workflow.py +285 -0
  47. nwqlib/algorithms/lchs/__init__.py +27 -0
  48. nwqlib/algorithms/lchs/analysis.py +330 -0
  49. nwqlib/algorithms/lchs/archive.py +274 -0
  50. nwqlib/algorithms/lchs/compiled_selection.py +766 -0
  51. nwqlib/algorithms/lchs/host.py +689 -0
  52. nwqlib/algorithms/lchs/host_pf.py +424 -0
  53. nwqlib/algorithms/lchs/inhomogeneous_theory.py +240 -0
  54. nwqlib/algorithms/lchs/method.py +318 -0
  55. nwqlib/algorithms/lchs/native.py +715 -0
  56. nwqlib/algorithms/lchs/parameters.py +552 -0
  57. nwqlib/algorithms/lchs/periodic.py +476 -0
  58. nwqlib/algorithms/lchs/primary_records.py +415 -0
  59. nwqlib/algorithms/lchs/provider_config.py +80 -0
  60. nwqlib/algorithms/lchs/providers.py +1649 -0
  61. nwqlib/algorithms/lchs/quantum.py +403 -0
  62. nwqlib/algorithms/lchs/quantum_resources.py +516 -0
  63. nwqlib/algorithms/lchs/references.py +188 -0
  64. nwqlib/algorithms/lchs/refinement.py +344 -0
  65. nwqlib/algorithms/lchs/select_synthesis.py +531 -0
  66. nwqlib/algorithms/lchs/selected_grid.py +586 -0
  67. nwqlib/algorithms/lchs/selection.py +182 -0
  68. nwqlib/algorithms/lchs/solution_error_budget.py +583 -0
  69. nwqlib/algorithms/lchs/source_selection.py +135 -0
  70. nwqlib/algorithms/lchs/time_independent_common.py +39 -0
  71. nwqlib/algorithms/lchs/time_independent_terms.py +2694 -0
  72. nwqlib/algorithms/lchs/verification.py +396 -0
  73. nwqlib/algorithms/protocol.py +152 -0
  74. nwqlib/algorithms/qhd/__init__.py +44 -0
  75. nwqlib/algorithms/qhd/_durable.py +535 -0
  76. nwqlib/algorithms/qhd/_outer.py +453 -0
  77. nwqlib/algorithms/qhd/archive.py +255 -0
  78. nwqlib/algorithms/qhd/binary.py +1729 -0
  79. nwqlib/algorithms/qhd/circuit_errors.py +677 -0
  80. nwqlib/algorithms/qhd/compiler.py +699 -0
  81. nwqlib/algorithms/qhd/constrained.py +3654 -0
  82. nwqlib/algorithms/qhd/constrained_records.py +1483 -0
  83. nwqlib/algorithms/qhd/decoding.py +262 -0
  84. nwqlib/algorithms/qhd/evolution_bounds.py +696 -0
  85. nwqlib/algorithms/qhd/grid.py +286 -0
  86. nwqlib/algorithms/qhd/initial_state.py +914 -0
  87. nwqlib/algorithms/qhd/kinetic.py +170 -0
  88. nwqlib/algorithms/qhd/method.py +4577 -0
  89. nwqlib/algorithms/qhd/native.py +285 -0
  90. nwqlib/algorithms/qhd/objective.py +184 -0
  91. nwqlib/algorithms/qhd/potential.py +281 -0
  92. nwqlib/algorithms/qhd/records.py +1318 -0
  93. nwqlib/algorithms/qhd/refinement.py +2908 -0
  94. nwqlib/algorithms/qhd/refinement_records.py +1238 -0
  95. nwqlib/algorithms/qhd/resources.py +1627 -0
  96. nwqlib/algorithms/qhd/schedules.py +792 -0
  97. nwqlib/algorithms/qhd/split_step.py +807 -0
  98. nwqlib/algorithms/qhd/theory.py +733 -0
  99. nwqlib/algorithms/qhd/validation.py +209 -0
  100. nwqlib/algorithms/qhd/verification.py +553 -0
  101. nwqlib/algorithms/qls/__init__.py +18 -0
  102. nwqlib/algorithms/qls/archive.py +303 -0
  103. nwqlib/algorithms/qls/constants.py +49 -0
  104. nwqlib/algorithms/qls/host_planning.py +986 -0
  105. nwqlib/algorithms/qls/method.py +862 -0
  106. nwqlib/algorithms/qls/norm_search.py +443 -0
  107. nwqlib/algorithms/qls/numerical.py +264 -0
  108. nwqlib/algorithms/qls/periodic.py +123 -0
  109. nwqlib/algorithms/qls/primary_records.py +763 -0
  110. nwqlib/algorithms/qls/quantum.py +2019 -0
  111. nwqlib/algorithms/qls/verification.py +628 -0
  112. nwqlib/algorithms/qpe/__init__.py +13 -0
  113. nwqlib/algorithms/qpe/archive.py +174 -0
  114. nwqlib/algorithms/qpe/controller.py +334 -0
  115. nwqlib/algorithms/qpe/method.py +2165 -0
  116. nwqlib/algorithms/qpe/numerical.py +919 -0
  117. nwqlib/algorithms/qpe/powers.py +1449 -0
  118. nwqlib/algorithms/qpe/records.py +1623 -0
  119. nwqlib/algorithms/qpe/verification.py +346 -0
  120. nwqlib/algorithms/registry.py +187 -0
  121. nwqlib/amplitudes.py +257 -0
  122. nwqlib/artifacts.py +680 -0
  123. nwqlib/backends/__init__.py +59 -0
  124. nwqlib/backends/_auxiliary_process.py +167 -0
  125. nwqlib/backends/_native/nwqsim_runner.cpp +828 -0
  126. nwqlib/backends/_qpy_buffer.py +17 -0
  127. nwqlib/backends/assessment.py +2057 -0
  128. nwqlib/backends/capabilities.py +203 -0
  129. nwqlib/backends/connection.py +506 -0
  130. nwqlib/backends/host.py +11 -0
  131. nwqlib/backends/ibm_runtime.py +743 -0
  132. nwqlib/backends/inspection.py +235 -0
  133. nwqlib/backends/ionq.py +578 -0
  134. nwqlib/backends/nexus.py +635 -0
  135. nwqlib/backends/nwqec.py +469 -0
  136. nwqlib/backends/nwqsim.py +1166 -0
  137. nwqlib/backends/profiles.py +300 -0
  138. nwqlib/backends/qiskit_aer.py +1074 -0
  139. nwqlib/backends/qre.py +354 -0
  140. nwqlib/backends/resources.py +119 -0
  141. nwqlib/backends/results.py +90 -0
  142. nwqlib/backends/slurm.py +660 -0
  143. nwqlib/backends/targets.py +26 -0
  144. nwqlib/backends/telemetry.py +407 -0
  145. nwqlib/blocks/__init__.py +18 -0
  146. nwqlib/blocks/_archive.py +156 -0
  147. nwqlib/blocks/_qiskit_intake.py +321 -0
  148. nwqlib/blocks/encoding.py +215 -0
  149. nwqlib/blocks/kernels.py +131 -0
  150. nwqlib/blocks/lowering.py +407 -0
  151. nwqlib/blocks/records.py +354 -0
  152. nwqlib/blocks/selection.py +759 -0
  153. nwqlib/cli.py +142 -0
  154. nwqlib/core/__init__.py +11 -0
  155. nwqlib/core/analysis.py +356 -0
  156. nwqlib/core/planning.py +1588 -0
  157. nwqlib/core/records.py +553 -0
  158. nwqlib/evidence/__init__.py +54 -0
  159. nwqlib/evidence/_work.py +145 -0
  160. nwqlib/evidence/binary.py +563 -0
  161. nwqlib/evidence/energy_shift.py +601 -0
  162. nwqlib/evidence/error_model.py +886 -0
  163. nwqlib/evidence/records.py +125 -0
  164. nwqlib/evidence/scalar_bound.py +198 -0
  165. nwqlib/evidence/sector.py +118 -0
  166. nwqlib/evidence/statistics.py +226 -0
  167. nwqlib/evidence/verification.py +226 -0
  168. nwqlib/execution.py +1921 -0
  169. nwqlib/io/__init__.py +10 -0
  170. nwqlib/io/materialization.py +103 -0
  171. nwqlib/io/qasm.py +88 -0
  172. nwqlib/io/streaming.py +504 -0
  173. nwqlib/ir/__init__.py +19 -0
  174. nwqlib/ir/expressions.py +182 -0
  175. nwqlib/ir/records.py +434 -0
  176. nwqlib/ir/selection.py +111 -0
  177. nwqlib/ir/validation.py +972 -0
  178. nwqlib/operators/__init__.py +32 -0
  179. nwqlib/operators/_factorized.py +219 -0
  180. nwqlib/operators/_fermion.py +305 -0
  181. nwqlib/operators/_pauli.py +697 -0
  182. nwqlib/operators/access.py +114 -0
  183. nwqlib/operators/df.py +412 -0
  184. nwqlib/operators/inputs.py +698 -0
  185. nwqlib/operators/refinement.py +375 -0
  186. nwqlib/problems/__init__.py +29 -0
  187. nwqlib/problems/inputs.py +524 -0
  188. nwqlib/problems/records.py +780 -0
  189. nwqlib/problems/scalars.py +127 -0
  190. nwqlib/py.typed +1 -0
  191. nwqlib/reporting/__init__.py +5 -0
  192. nwqlib/reporting/records.py +21 -0
  193. nwqlib/resources/__init__.py +17 -0
  194. nwqlib/resources/fold.py +1065 -0
  195. nwqlib/resources/records.py +416 -0
  196. nwqlib/saved_evidence.py +418 -0
  197. nwqlib/scientist.py +637 -0
  198. nwqlib/search.py +705 -0
  199. nwqlib/serialization.py +54 -0
  200. nwqlib/subroutines/__init__.py +1 -0
  201. nwqlib/subroutines/_dense_synthesis.py +1422 -0
  202. nwqlib/subroutines/_matrix_checks.py +30 -0
  203. nwqlib/subroutines/_mcx_counts.py +36 -0
  204. nwqlib/subroutines/_multiplexors.py +827 -0
  205. nwqlib/subroutines/_power_of_two.py +25 -0
  206. nwqlib/subroutines/_registry_utils.py +70 -0
  207. nwqlib/subroutines/_semantic.py +124 -0
  208. nwqlib/subroutines/_serialization.py +37 -0
  209. nwqlib/subroutines/block_encoding/__init__.py +34 -0
  210. nwqlib/subroutines/block_encoding/banded.py +313 -0
  211. nwqlib/subroutines/block_encoding/core.py +1682 -0
  212. nwqlib/subroutines/block_encoding/registry.py +65 -0
  213. nwqlib/subroutines/dense_matrices.py +52 -0
  214. nwqlib/subroutines/fermionic_circuits.py +869 -0
  215. nwqlib/subroutines/fermionic_pool.py +1232 -0
  216. nwqlib/subroutines/hamiltonian_evolution/__init__.py +29 -0
  217. nwqlib/subroutines/hamiltonian_evolution/pauli_evolution.py +442 -0
  218. nwqlib/subroutines/hamiltonian_evolution/pauli_ir.py +89 -0
  219. nwqlib/subroutines/hamiltonian_evolution/pauli_labels.py +112 -0
  220. nwqlib/subroutines/hamiltonian_evolution/sparse_pauli_product.py +81 -0
  221. nwqlib/subroutines/lcu/__init__.py +26 -0
  222. nwqlib/subroutines/lcu/core.py +687 -0
  223. nwqlib/subroutines/lcu/data.py +106 -0
  224. nwqlib/subroutines/lcu/registry.py +41 -0
  225. nwqlib/subroutines/pauli_decomposition.py +241 -0
  226. nwqlib/subroutines/qiskit_compat.py +630 -0
  227. nwqlib/subroutines/qpe/__init__.py +15 -0
  228. nwqlib/subroutines/qpe/coherent.py +189 -0
  229. nwqlib/subroutines/qsp/__init__.py +42 -0
  230. nwqlib/subroutines/qsp/evolution.py +1566 -0
  231. nwqlib/subroutines/qsp/inverse.py +354 -0
  232. nwqlib/subroutines/qsp/phases.py +743 -0
  233. nwqlib/subroutines/qsp/shortcut.py +220 -0
  234. nwqlib/subroutines/state_preparation/__init__.py +41 -0
  235. nwqlib/subroutines/state_preparation/direct.py +163 -0
  236. nwqlib/subroutines/state_preparation/mps.py +451 -0
  237. nwqlib/subroutines/state_preparation/mps_circuit.py +450 -0
  238. nwqlib/subroutines/trotterization/__init__.py +32 -0
  239. nwqlib/subroutines/trotterization/error_budget.py +1967 -0
  240. nwqlib/subroutines/xacc.py +118 -0
  241. nwqlib-1.0.0.dist-info/METADATA +169 -0
  242. nwqlib-1.0.0.dist-info/RECORD +246 -0
  243. nwqlib-1.0.0.dist-info/WHEEL +5 -0
  244. nwqlib-1.0.0.dist-info/entry_points.txt +2 -0
  245. nwqlib-1.0.0.dist-info/licenses/LICENSE +24 -0
  246. nwqlib-1.0.0.dist-info/top_level.txt +1 -0
nwqlib/__init__.py ADDED
@@ -0,0 +1,63 @@
1
+ """NWQLib package root.
2
+
3
+ Root modules resolve lazily (PEP 562), so importing the root does not load
4
+ the whole library. ``__all__`` lists the current advertised entries; each
5
+ scientific owner defines its supported operations.
6
+ """
7
+
8
+ from importlib import import_module
9
+ from importlib.metadata import PackageNotFoundError, version
10
+ from typing import Any
11
+
12
+ try:
13
+ __version__ = version("nwqlib")
14
+ except PackageNotFoundError:
15
+ __version__ = "0.0.0"
16
+
17
+ _SCIENTIST_OPERATIONS = ("plan", "compare", "estimate", "prepare", "submit", "solve",
18
+ "load_result", "load_run", "methods")
19
+ _SEARCH_OPERATIONS = ("scan",)
20
+ _SCIENTIFIC_INPUTS = (
21
+ "Accuracy", "ConstrainedOptimization", "Eigenphase", "Eigenproblem", "Eigenvalue", "Expectation",
22
+ "LinearDynamics", "LinearSystem", "NormalizedExpectation", "NormSquared",
23
+ "Optimization", "OptimizationCandidate", "QuadraticForm", "Samples",
24
+ "Solution", "SpectralEstimation", "StateVector",
25
+ )
26
+
27
+ __all__ = [
28
+ "__version__",
29
+ "algorithms",
30
+ "backends",
31
+ "execution",
32
+ "reporting",
33
+ "subroutines",
34
+ *_SCIENTIST_OPERATIONS,
35
+ *_SEARCH_OPERATIONS,
36
+ *_SCIENTIFIC_INPUTS,
37
+ ]
38
+
39
+ def __getattr__(name: str) -> Any:
40
+ """Resolve a root name lazily (PEP 562), importing only its owner.
41
+
42
+ A missing first-level module becomes AttributeError. An ImportError raised
43
+ inside an existing module, such as a missing optional dependency, propagates
44
+ unchanged so it is not mistaken for a missing attribute.
45
+ """
46
+ if name in _SCIENTIFIC_INPUTS:
47
+ return getattr(import_module("nwqlib.problems.records"), name)
48
+ if name in _SCIENTIST_OPERATIONS:
49
+ return getattr(import_module("nwqlib.scientist"), name)
50
+ if name in _SEARCH_OPERATIONS:
51
+ return getattr(import_module("nwqlib.search"), name)
52
+ try:
53
+ return import_module(f"nwqlib.{name}")
54
+ except ModuleNotFoundError as exc:
55
+ if exc.name == f"nwqlib.{name}":
56
+ raise AttributeError(
57
+ f"module 'nwqlib' has no attribute {name!r}"
58
+ ) from None
59
+ raise
60
+
61
+
62
+ def __dir__() -> list[str]:
63
+ return sorted(set(__all__) | set(globals()))
nwqlib/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """Run the same public CLI as the installed console entry."""
2
+
3
+ from nwqlib.cli import main
4
+
5
+ raise SystemExit(main())