markovq 0.1.0__tar.gz

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 (83) hide show
  1. markovq-0.1.0/CHANGELOG.md +21 -0
  2. markovq-0.1.0/CITATION.cff +10 -0
  3. markovq-0.1.0/LICENSE +74 -0
  4. markovq-0.1.0/MANIFEST.in +3 -0
  5. markovq-0.1.0/PKG-INFO +125 -0
  6. markovq-0.1.0/README.md +29 -0
  7. markovq-0.1.0/benchmarks/applied.py +329 -0
  8. markovq-0.1.0/benchmarks/applied_figure.py +33 -0
  9. markovq-0.1.0/benchmarks/consolidation.py +195 -0
  10. markovq-0.1.0/benchmarks/data/README.md +5 -0
  11. markovq-0.1.0/benchmarks/data/crambin.csv +47 -0
  12. markovq-0.1.0/benchmarks/foundations.py +58 -0
  13. markovq-0.1.0/benchmarks/phase_suite.py +57 -0
  14. markovq-0.1.0/benchmarks/quantum.py +159 -0
  15. markovq-0.1.0/benchmarks/quantum_figure.py +54 -0
  16. markovq-0.1.0/benchmarks/stability.py +58 -0
  17. markovq-0.1.0/docs/applied-benchmarks.json +961 -0
  18. markovq-0.1.0/docs/applied.md +35 -0
  19. markovq-0.1.0/docs/benchmark-results.json +36 -0
  20. markovq-0.1.0/docs/case-studies/phase-suite.json +151 -0
  21. markovq-0.1.0/docs/case-studies/study-1.json +53 -0
  22. markovq-0.1.0/docs/case-studies/study-2.json +44 -0
  23. markovq-0.1.0/docs/case-studies/study-3.json +45 -0
  24. markovq-0.1.0/docs/case-studies/study-4.json +73 -0
  25. markovq-0.1.0/docs/case-studies/study-5.json +327 -0
  26. markovq-0.1.0/docs/consolidation-review.md +47 -0
  27. markovq-0.1.0/docs/crambin-ranking.svg +48 -0
  28. markovq-0.1.0/docs/final-acceptance.md +27 -0
  29. markovq-0.1.0/docs/final-remediation.md +59 -0
  30. markovq-0.1.0/docs/final-scaling.json +495 -0
  31. markovq-0.1.0/docs/foundations-acceptance.md +9 -0
  32. markovq-0.1.0/docs/foundations.md +33 -0
  33. markovq-0.1.0/docs/numerical-stability.md +39 -0
  34. markovq-0.1.0/docs/quantum-acceptance.md +24 -0
  35. markovq-0.1.0/docs/quantum-benchmarks.json +600 -0
  36. markovq-0.1.0/docs/quantum-benchmarks.svg +951 -0
  37. markovq-0.1.0/docs/quantum.md +61 -0
  38. markovq-0.1.0/docs/release-notes.md +7 -0
  39. markovq-0.1.0/docs/scalability-benchmarks.md +20 -0
  40. markovq-0.1.0/docs/scalability-data.json +495 -0
  41. markovq-0.1.0/markovq/__init__.py +92 -0
  42. markovq-0.1.0/markovq/_types.py +11 -0
  43. markovq-0.1.0/markovq/batch.py +189 -0
  44. markovq-0.1.0/markovq/chains.py +168 -0
  45. markovq-0.1.0/markovq/circuits.py +162 -0
  46. markovq-0.1.0/markovq/classification.py +43 -0
  47. markovq-0.1.0/markovq/continuous.py +105 -0
  48. markovq-0.1.0/markovq/interop.py +146 -0
  49. markovq-0.1.0/markovq/jumps.py +44 -0
  50. markovq-0.1.0/markovq/mixing.py +96 -0
  51. markovq-0.1.0/markovq/networks.py +126 -0
  52. markovq-0.1.0/markovq/noise.py +92 -0
  53. markovq-0.1.0/markovq/passage.py +122 -0
  54. markovq-0.1.0/markovq/processes.py +79 -0
  55. markovq-0.1.0/markovq/py.typed +0 -0
  56. markovq-0.1.0/markovq/quantum/__init__.py +57 -0
  57. markovq-0.1.0/markovq/quantum/implicit.py +63 -0
  58. markovq-0.1.0/markovq/quantum/measurement.py +402 -0
  59. markovq-0.1.0/markovq/quantum/open_systems.py +205 -0
  60. markovq-0.1.0/markovq/quantum/search.py +212 -0
  61. markovq-0.1.0/markovq/quantum/walks.py +221 -0
  62. markovq-0.1.0/markovq/reporting.py +207 -0
  63. markovq-0.1.0/markovq/spectral.py +129 -0
  64. markovq-0.1.0/markovq/walks.py +158 -0
  65. markovq-0.1.0/markovq.egg-info/PKG-INFO +125 -0
  66. markovq-0.1.0/markovq.egg-info/SOURCES.txt +81 -0
  67. markovq-0.1.0/markovq.egg-info/dependency_links.txt +1 -0
  68. markovq-0.1.0/markovq.egg-info/requires.txt +12 -0
  69. markovq-0.1.0/markovq.egg-info/top_level.txt +1 -0
  70. markovq-0.1.0/pyproject.toml +29 -0
  71. markovq-0.1.0/setup.cfg +4 -0
  72. markovq-0.1.0/tests/test_applied.py +147 -0
  73. markovq-0.1.0/tests/test_applied_references.py +122 -0
  74. markovq-0.1.0/tests/test_classification.py +21 -0
  75. markovq-0.1.0/tests/test_consolidation_regressions.py +72 -0
  76. markovq-0.1.0/tests/test_final_remediation.py +137 -0
  77. markovq-0.1.0/tests/test_foundations.py +278 -0
  78. markovq-0.1.0/tests/test_jumps.py +26 -0
  79. markovq-0.1.0/tests/test_numerical_stress.py +331 -0
  80. markovq-0.1.0/tests/test_phase_suite.py +28 -0
  81. markovq-0.1.0/tests/test_quantum.py +230 -0
  82. markovq-0.1.0/tests/test_quantum_references.py +41 -0
  83. markovq-0.1.0/tests/test_reference_models.py +118 -0
@@ -0,0 +1,21 @@
1
+ # Changes
2
+
3
+ ## 0.1.0
4
+
5
+ Initial public release of the 25 scientific modules. See [release notes](docs/release-notes.md).
6
+
7
+ ## Unreleased
8
+
9
+ Classical probability and spectral graph foundations, roadmap modules 01–12.
10
+
11
+ Added quantum dynamics modules 13–20, independent Qiskit and QuTiP references, and classical-versus-quantum, detection, search and open-system benchmarks.
12
+
13
+ Numerical consolidation of modules 01–20 adds tolerance diagnostics, conditional duration checks, finite-time spectral references, implicit Szegedy and Lindblad actions, per-resource overflow handling and controlled cross-platform benchmarks.
14
+
15
+ ## Development branch — applied modules 21–25
16
+
17
+ Added Kraus channels, biological network ranking, partitioned endpoint sampling, Qiskit circuits, optional PhaseTensor integration and reproducible experiment exports. See [scientific evidence](docs/applied.md).
18
+
19
+ ## Final remediation before 0.1.0
20
+
21
+ Corrected log-domain ranking, defective detection times, readout estimator reporting, strict scientific exports, simulation-plan integrity and circuit resource accounting. NamedTuple field extensions in development require named-attribute access for compatibility.
@@ -0,0 +1,10 @@
1
+ cff-version: 1.2.0
2
+ message: "Please cite MarkovQ when using this software."
3
+ title: MarkovQ
4
+ authors:
5
+ - name: PhaseTensor
6
+ repository-code: https://github.com/Phasetensor/MarkovQ
7
+ license: Apache-2.0
8
+ type: software
9
+ version: 0.1.0
10
+ abstract: "Scientific Python software for classical stochastic processes and quantum graph dynamics."
markovq-0.1.0/LICENSE ADDED
@@ -0,0 +1,74 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
42
+
43
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
56
+
57
+ APPENDIX: How to apply the Apache License to your work.
58
+
59
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
60
+
61
+ Copyright [yyyy] [name of copyright owner]
62
+
63
+ Licensed under the Apache License, Version 2.0 (the "License");
64
+ you may not use this file except in compliance with the License.
65
+ You may obtain a copy of the License at
66
+
67
+ http://www.apache.org/licenses/LICENSE-2.0
68
+
69
+ Unless required by applicable law or agreed to in writing, software
70
+ distributed under the License is distributed on an "AS IS" BASIS,
71
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
72
+ See the License for the specific language governing permissions and
73
+ limitations under the License.
74
+
@@ -0,0 +1,3 @@
1
+ include CITATION.cff CHANGELOG.md
2
+ recursive-include docs *.md *.json *.svg
3
+ recursive-include benchmarks *.py *.csv *.md
markovq-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,125 @@
1
+ Metadata-Version: 2.4
2
+ Name: markovq
3
+ Version: 0.1.0
4
+ Summary: Classical and quantum stochastic dynamics
5
+ License: Apache License
6
+ Version 2.0, January 2004
7
+ http://www.apache.org/licenses/
8
+
9
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
+
11
+ 1. Definitions.
12
+
13
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
14
+
15
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
18
+
19
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
20
+
21
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
22
+
23
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
24
+
25
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
26
+
27
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
28
+
29
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
30
+
31
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
32
+
33
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
34
+
35
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
36
+
37
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
38
+
39
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
40
+
41
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
42
+
43
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
44
+
45
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
46
+
47
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
48
+
49
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
50
+
51
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
52
+
53
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
54
+
55
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
56
+
57
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
58
+
59
+ END OF TERMS AND CONDITIONS
60
+
61
+ APPENDIX: How to apply the Apache License to your work.
62
+
63
+ To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
64
+
65
+ Copyright [yyyy] [name of copyright owner]
66
+
67
+ Licensed under the Apache License, Version 2.0 (the "License");
68
+ you may not use this file except in compliance with the License.
69
+ You may obtain a copy of the License at
70
+
71
+ http://www.apache.org/licenses/LICENSE-2.0
72
+
73
+ Unless required by applicable law or agreed to in writing, software
74
+ distributed under the License is distributed on an "AS IS" BASIS,
75
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
76
+ See the License for the specific language governing permissions and
77
+ limitations under the License.
78
+
79
+
80
+ Project-URL: Repository, https://github.com/Phasetensor/MarkovQ
81
+ Project-URL: Issues, https://github.com/Phasetensor/MarkovQ/issues
82
+ Requires-Python: >=3.9
83
+ Description-Content-Type: text/markdown
84
+ License-File: LICENSE
85
+ Requires-Dist: numpy>=1.23
86
+ Requires-Dist: scipy>=1.9
87
+ Provides-Extra: interop
88
+ Requires-Dist: calibmap==0.1.0; extra == "interop"
89
+ Requires-Dist: shotweave==0.2.0; extra == "interop"
90
+ Requires-Dist: bornlens==0.3.1; extra == "interop"
91
+ Requires-Dist: qiskit>=1; extra == "interop"
92
+ Provides-Extra: references
93
+ Requires-Dist: qiskit>=1; extra == "references"
94
+ Requires-Dist: qutip>=5; extra == "references"
95
+ Dynamic: license-file
96
+
97
+ # MarkovQ
98
+
99
+ PhaseTensor’s scientific Python framework for classical and quantum stochastic dynamics. MarkovQ implements modules 01–25, from classical Markov processes and spectral graph operators to quantum walks, monitored detection, graph search, Lindblad evolution, noise channels, network ranking, partitioned simulation, circuit integration and scientific reporting.
100
+
101
+ ## Install MarkovQ 0.1.0
102
+
103
+ ```sh
104
+ python -m pip install markovq==0.1.0
105
+ ```
106
+
107
+ ```python
108
+ from markovq import absorption, line_walk
109
+
110
+ walk = line_walk(9, boundary="absorb")
111
+ result = absorption(walk.P)
112
+ print(dict(zip(result.transient, result.mean))) # state 4: 16 steps
113
+ ```
114
+
115
+ Install the independent reference solvers with `python -m pip install '.[references]' pytest` and run `python -m pytest`. Reproduce the benchmarks with `python -m benchmarks.foundations` and `python -m benchmarks.quantum`.
116
+
117
+ [Quantum API and scientific conventions](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/quantum.md) · [Quantum benchmark results](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/quantum-benchmarks.json)
118
+
119
+ [Scientific specifications and traceability](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/foundations.md) · [Measured benchmark results](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/benchmark-results.json) · [License](LICENSE)
120
+
121
+ [Numerical consolidation review](docs/consolidation-review.md) · [Precision and solver guidance](docs/numerical-stability.md) · [Scaling measurements](docs/scalability-benchmarks.md)
122
+
123
+ [Applied modules, case studies and benchmark index](docs/applied.md)
124
+
125
+ The 25 areas cover chains, classical walks, classification, recurrence, absorption, first passage, stationarity, mixing, continuous-time chains, Lévy models, graph Hamiltonians, spectral analysis, discrete and continuous quantum walks, Szegedy walks, monitored detection, quantum recurrence, quantum mixing, search, open dynamics, noise channels, biological networks, partitioned simulation, circuit adapters and scientific reporting. Hardware-adapter evidence uses simulators. [Final remediation](docs/final-remediation.md) · [Release notes](docs/release-notes.md).
@@ -0,0 +1,29 @@
1
+ # MarkovQ
2
+
3
+ PhaseTensor’s scientific Python framework for classical and quantum stochastic dynamics. MarkovQ implements modules 01–25, from classical Markov processes and spectral graph operators to quantum walks, monitored detection, graph search, Lindblad evolution, noise channels, network ranking, partitioned simulation, circuit integration and scientific reporting.
4
+
5
+ ## Install MarkovQ 0.1.0
6
+
7
+ ```sh
8
+ python -m pip install markovq==0.1.0
9
+ ```
10
+
11
+ ```python
12
+ from markovq import absorption, line_walk
13
+
14
+ walk = line_walk(9, boundary="absorb")
15
+ result = absorption(walk.P)
16
+ print(dict(zip(result.transient, result.mean))) # state 4: 16 steps
17
+ ```
18
+
19
+ Install the independent reference solvers with `python -m pip install '.[references]' pytest` and run `python -m pytest`. Reproduce the benchmarks with `python -m benchmarks.foundations` and `python -m benchmarks.quantum`.
20
+
21
+ [Quantum API and scientific conventions](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/quantum.md) · [Quantum benchmark results](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/quantum-benchmarks.json)
22
+
23
+ [Scientific specifications and traceability](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/foundations.md) · [Measured benchmark results](https://github.com/Phasetensor/MarkovQ/blob/v0.1.0/docs/benchmark-results.json) · [License](LICENSE)
24
+
25
+ [Numerical consolidation review](docs/consolidation-review.md) · [Precision and solver guidance](docs/numerical-stability.md) · [Scaling measurements](docs/scalability-benchmarks.md)
26
+
27
+ [Applied modules, case studies and benchmark index](docs/applied.md)
28
+
29
+ The 25 areas cover chains, classical walks, classification, recurrence, absorption, first passage, stationarity, mixing, continuous-time chains, Lévy models, graph Hamiltonians, spectral analysis, discrete and continuous quantum walks, Szegedy walks, monitored detection, quantum recurrence, quantum mixing, search, open dynamics, noise channels, biological networks, partitioned simulation, circuit adapters and scientific reporting. Hardware-adapter evidence uses simulators. [Final remediation](docs/final-remediation.md) · [Release notes](docs/release-notes.md).
@@ -0,0 +1,329 @@
1
+ """Applications and acceptance cases for MarkovQ, using no provider credentials."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import csv
6
+ import hashlib
7
+ import json
8
+ import platform
9
+ import resource
10
+ import sys
11
+ from pathlib import Path
12
+ from time import perf_counter
13
+
14
+ import numpy as np
15
+ from scipy import sparse
16
+ from scipy.spatial.distance import cdist
17
+ from scipy.stats import spearmanr
18
+
19
+ from markovq import absorption, line_walk
20
+ from markovq import quantum as q
21
+ from markovq.batch import simulate_endpoints
22
+ from markovq.networks import heldout_metrics, rank_nodes, spectral_communities
23
+ from markovq.noise import kraus_model, noisy_walk, readout
24
+ from markovq.reporting import experiment_record, render
25
+
26
+ DATA = Path(__file__).parent / "data" / "crambin.csv"
27
+
28
+
29
+ def protein():
30
+ with DATA.open() as stream:
31
+ rows = list(csv.DictReader(stream))
32
+ coords = np.array([[float(r[k]) for k in "xyz"] for r in rows])
33
+ residue = np.array([int(r["residue"]) for r in rows])
34
+ helix = np.array([int(r["helix"]) for r in rows], bool)
35
+ dist = cdist(coords, coords)
36
+ graph = ((dist <= 8) & (dist > 0)).astype(float)
37
+ # All training seeds in helix 7–19. Evaluate residues 22–46 only.
38
+ pool = np.flatnonzero(helix & (residue <= 19))
39
+ test = residue >= 22
40
+ pos = np.flatnonzero(test & helix)
41
+ neg = np.flatnonzero(test & ~helix)
42
+ trials = []
43
+ score_history = {}
44
+ for seed in (501, 502, 503, 504, 505):
45
+ selected = np.sort(np.random.default_rng(seed).choice(pool, 4, replace=False))
46
+ started = perf_counter()
47
+ scores = rank_nodes(graph, selected, restart=0.2, time=0.5)
48
+ elapsed = perf_counter() - started
49
+ trials.append(
50
+ {
51
+ "rng_seed": seed,
52
+ "seed_residues": residue[selected].tolist(),
53
+ "runtime_s": elapsed,
54
+ "metrics": {
55
+ name: heldout_metrics(score, selected, pos, neg, 5)
56
+ for name, score in scores.items()
57
+ },
58
+ }
59
+ )
60
+ for name, score in scores.items():
61
+ score_history.setdefault(name, []).append(score[test])
62
+ stability = {}
63
+ for name, values in score_history.items():
64
+ correlations = [
65
+ float(spearmanr(a, b)[0]) for i, a in enumerate(values) for b in values[:i]
66
+ ]
67
+ stability[name] = float(np.mean(correlations))
68
+ communities = spectral_communities(graph)
69
+ return {
70
+ "dataset": "PDB 1CRN, crambin, chain A",
71
+ "input_sha256": hashlib.sha256(DATA.read_bytes()).hexdigest(),
72
+ "nodes": len(rows),
73
+ "edges": int(graph.sum() / 2),
74
+ "positive_test_residues": residue[pos].tolist(),
75
+ "negative_test_residues": residue[neg].tolist(),
76
+ "trials": trials,
77
+ "mean_pairwise_spearman": stability,
78
+ "community_method": communities["status"],
79
+ "community_labels": communities["labels"].tolist(),
80
+ }
81
+
82
+
83
+ def noise_benchmark():
84
+ step = q.cycle_walk(4).operator
85
+ rho = np.diag([1] + [0] * 7)
86
+ ideal = noisy_walk(step, rho, [np.eye(8)], 8)
87
+ rows = []
88
+ for name in ("depolarizing", "dephasing", "amplitude-damping"):
89
+ for p in (0.0, 0.02, 0.15, 1.0):
90
+ ops = [np.kron(k, np.eye(4)) for k in kraus_model(name, p)]
91
+ out = noisy_walk(step, rho, ops, 8)
92
+ position = out.populations[-1].reshape(2, 4).sum(axis=0)
93
+ ideal_pos = ideal.populations[-1].reshape(2, 4).sum(axis=0)
94
+ rows.append(
95
+ {
96
+ "channel": name,
97
+ "strength": p,
98
+ "position": position.tolist(),
99
+ "purity": float(out.purity[-1]),
100
+ "coherence": float(out.coherence[-1]),
101
+ "tv": float(abs(position - ideal_pos).sum() / 2),
102
+ "trace_error": float(out.trace_error.max()),
103
+ "readout_tv": float(
104
+ abs(
105
+ readout(
106
+ position, 0.92 * np.eye(4) + 0.08 * np.ones((4, 4)) / 4
107
+ )
108
+ - position
109
+ ).sum()
110
+ / 2
111
+ ),
112
+ }
113
+ )
114
+ return rows
115
+
116
+
117
+ def batch_benchmark():
118
+ rows = []
119
+ for n in (16, 64, 256):
120
+ np.random.default_rng(901)
121
+ a = sparse.diags(
122
+ [0.25 * np.ones(n - 1), 0.5 * np.ones(n), 0.25 * np.ones(n - 1)],
123
+ [-1, 0, 1],
124
+ format="lil",
125
+ )
126
+ a[0, 0] = a[-1, -1] = 0.75
127
+ p = a.tocsr()
128
+ law = np.zeros(n)
129
+ law[n // 2] = 1
130
+ reference = law.copy()
131
+ for _ in range(16):
132
+ reference = reference @ p
133
+ for workers in (1, 2):
134
+ elapsed = []
135
+ for _ in range(3):
136
+ start = perf_counter()
137
+ result = simulate_endpoints(
138
+ p, law, 16, 10000, seed=901, batch_size=1000, workers=workers
139
+ )
140
+ elapsed.append(perf_counter() - start)
141
+ median = float(np.median(elapsed))
142
+ rows.append(
143
+ {
144
+ "states": n,
145
+ "workers": workers,
146
+ "shots": 10000,
147
+ "steps": 16,
148
+ "seed": 901,
149
+ "counts": result.counts.tolist(),
150
+ "max_standard_error": float(max(result.standard_errors)),
151
+ "max_probability_error": float(
152
+ max(abs(result.counts / 10000 - reference))
153
+ ),
154
+ "sparse_bytes": result.storage_bytes,
155
+ "median_seconds": median,
156
+ "min_seconds": min(elapsed),
157
+ "max_seconds": max(elapsed),
158
+ "paths_per_second": 10000 / median,
159
+ }
160
+ )
161
+ for i, row in enumerate(rows):
162
+ row["parallel_efficiency"] = rows[i - i % 2]["median_seconds"] / (
163
+ row["median_seconds"] * row["workers"]
164
+ )
165
+ return rows
166
+
167
+
168
+ def build_studies(include_suite=True):
169
+ studies = []
170
+
171
+ def add(
172
+ name, inputs, protocol, solver, baseline, limits, calculate, seed=0, tol=1e-10
173
+ ):
174
+ start = perf_counter()
175
+ results = calculate()
176
+ peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * (
177
+ 1 if sys.platform == "darwin" else 1024
178
+ )
179
+ studies.append(
180
+ experiment_record(
181
+ model=name,
182
+ inputs=inputs,
183
+ protocol=protocol,
184
+ seed=seed,
185
+ solver=solver,
186
+ tolerance=tol,
187
+ baseline=baseline,
188
+ runtime_s=perf_counter() - start,
189
+ peak_rss_bytes=peak,
190
+ limitations=limits,
191
+ results=results,
192
+ )
193
+ )
194
+
195
+ def setup(graph, state, boundaries="finite", dataset="synthetic"):
196
+ return {
197
+ "graph": graph,
198
+ "initial_state": state,
199
+ "boundaries": boundaries,
200
+ "dataset": dataset,
201
+ }
202
+
203
+ def spread():
204
+ output = []
205
+ for n in (8, 16, 32, 64, 128):
206
+ x, p = q.line_distribution(n)
207
+ output.append(
208
+ {"steps": n, "quantum_msd": float(p @ (x * x)), "classical_msd": n}
209
+ )
210
+ return {"rows": output}
211
+
212
+ add(
213
+ "Line spreading",
214
+ setup("integer line", "origin, symmetric complex coin", "reachable light cone"),
215
+ "terminal position",
216
+ "coined shift",
217
+ "classical exact MSD = n",
218
+ "Specific initial coin and unbiased steps.",
219
+ spread,
220
+ )
221
+
222
+ def ruin():
223
+ r = absorption(line_walk(9, boundary="absorb").P)
224
+ return {
225
+ "mean": r.mean.tolist(),
226
+ "exact_mean": [i * (8 - i) for i in range(1, 8)],
227
+ }
228
+
229
+ add(
230
+ "Gambler's ruin",
231
+ setup("path 0–8", "all interior states", "absorbing endpoints"),
232
+ "first boundary entry",
233
+ "linear solve",
234
+ "i(8-i)",
235
+ "Finite fair game.",
236
+ ruin,
237
+ )
238
+
239
+ def sz():
240
+ w = q.szegedy([[0.75, 0.25], [0.25, 0.75]])
241
+ return {
242
+ "phases": np.sort(np.angle(np.linalg.eigvals(w.operator))).tolist(),
243
+ "classical_eigenvalues": [0.5, 1.0],
244
+ }
245
+
246
+ add(
247
+ "Szegedy correspondence",
248
+ setup([[0.75, 0.25], [0.25, 0.75]], "entire operator"),
249
+ "spectrum",
250
+ "two reflections",
251
+ "2 arccos(0.5)",
252
+ "Small reversible kernel.",
253
+ sz,
254
+ )
255
+
256
+ def detection():
257
+ from scipy.linalg import block_diag
258
+
259
+ u = block_diag(q.hadamard(), 1)
260
+ v = np.array([1, 0, 1]) / np.sqrt(2)
261
+ target = np.diag([1, 0, 0])
262
+ d = q.first_detection(u, v, target, 12)
263
+ rec = q.recurrence(u, v, 12)
264
+ return {
265
+ "first": d.first.tolist(),
266
+ "survival": d.survival.tolist(),
267
+ "return_occupancy": rec.occupancy.tolist(),
268
+ "eventual": q.eventual_detection(u, v, target).probability,
269
+ "renewal_error": float(
270
+ max(abs(abs(rec.first_amplitudes) ** 2 - rec.monitored.first))
271
+ ),
272
+ }
273
+
274
+ add(
275
+ "Monitored recurrence and detection",
276
+ setup("Hadamard plus invariant dark site", "equal bright/dark amplitudes"),
277
+ "evolve then project",
278
+ "conditional evolution",
279
+ "geometric detection mass",
280
+ "Finite protocol; monitored return uses initial-state projector.",
281
+ detection,
282
+ )
283
+ add(
284
+ "Biological network ranking",
285
+ setup(
286
+ "8 angstrom C-alpha contacts",
287
+ "four helix-1 seed residues",
288
+ dataset="PDB 1CRN, chain A",
289
+ ),
290
+ "held-out helix 2, negatives from residues >=22",
291
+ "restart, diffusion, CTQW",
292
+ "degree and one-step walk",
293
+ "Single plant protein, structurally correlated annotation, fixed graph, no independent biological discovery.",
294
+ protein,
295
+ 501,
296
+ )
297
+ if include_suite:
298
+ from benchmarks.phase_suite import run
299
+
300
+ add(
301
+ "PhaseTensor noise-aware walk",
302
+ setup("four-cycle", "coin 0 at vertex 0"),
303
+ "pilot then fresh final samples",
304
+ "Qiskit and synthetic readout",
305
+ "ideal Pauli and position samples",
306
+ "Independent directional readout model; no hardware execution.",
307
+ run,
308
+ 2415,
309
+ )
310
+ return studies
311
+
312
+
313
+ def export(directory: Path, include_suite=True):
314
+ directory.mkdir(parents=True, exist_ok=True)
315
+ for i, record in enumerate(build_studies(include_suite), 1):
316
+ for fmt in ("json", "csv", "html"):
317
+ (directory / f"study-{i}.{fmt}").write_text(render(record, fmt))
318
+ evidence = {
319
+ "noise": noise_benchmark(),
320
+ "batch": batch_benchmark(),
321
+ "platform": platform.platform(),
322
+ }
323
+ (directory / "applied.json").write_text(
324
+ json.dumps(evidence, allow_nan=False, indent=2)
325
+ )
326
+
327
+
328
+ if __name__ == "__main__":
329
+ export(Path(sys.argv[1]), "--core-only" not in sys.argv[2:])
@@ -0,0 +1,33 @@
1
+ """Render the five held-out AUROC observations for each ranking method."""
2
+
3
+ import json
4
+ import sys
5
+ from pathlib import Path
6
+
7
+
8
+ def figure(record: dict) -> str:
9
+ trials = record["results"]["trials"]
10
+ methods = sorted(trials[0]["metrics"])
11
+ parts = [
12
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 300">',
13
+ "<title>Crambin held-out ranking by seed selection</title>",
14
+ '<rect width="720" height="300" fill="white"/>',
15
+ '<g font-family="sans-serif" fill="#172c40">',
16
+ '<text x="18" y="30" font-size="20">Crambin · held-out AUROC</text>',
17
+ ]
18
+ for tick in range(6):
19
+ x = 190 + 96 * tick
20
+ parts.append(f'<path d="M{x} 52v188" stroke="#ddd"/>')
21
+ parts.append(f'<text x="{x - 10}" y="266">{tick / 5:.1f}</text>')
22
+ for i, method in enumerate(methods):
23
+ y = 70 + 36 * i
24
+ parts.append(f'<text x="18" y="{y + 6}">{method}</text>')
25
+ for j, trial in enumerate(trials):
26
+ x = 190 + 480 * trial["metrics"][method]["auroc"]
27
+ parts.append(f'<circle cx="{x:.2f}" cy="{y + 3 * j}" r="3" fill="#075"/>')
28
+ parts.append("</g></svg>")
29
+ return "\n".join(parts)
30
+
31
+
32
+ if __name__ == "__main__":
33
+ print(figure(json.loads(Path(sys.argv[1]).read_text())))