tensorcircuit-nightly 1.3.0.dev20250727__tar.gz → 1.3.0.dev20250729__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.

Potentially problematic release.


This version of tensorcircuit-nightly might be problematic. Click here for more details.

Files changed (149) hide show
  1. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/CHANGELOG.md +4 -0
  2. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/PKG-INFO +2 -2
  3. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/README.md +1 -1
  4. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/README_cn.md +7 -3
  5. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/modules.rst +1 -0
  6. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/__init__.py +2 -1
  7. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/abstract_backend.py +3 -0
  8. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/tensorflow_backend.py +8 -1
  9. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/experimental.py +7 -152
  10. tensorcircuit_nightly-1.3.0.dev20250729/tensorcircuit/timeevol.py +346 -0
  11. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit_nightly.egg-info/PKG-INFO +2 -2
  12. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit_nightly.egg-info/SOURCES.txt +2 -0
  13. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_miscs.py +0 -30
  14. tensorcircuit_nightly-1.3.0.dev20250729/tests/test_timeevol.py +238 -0
  15. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/HISTORY.md +0 -0
  16. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/LICENSE +0 -0
  17. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/MANIFEST.in +0 -0
  18. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/advance.rst +0 -0
  19. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/cnconf.py +0 -0
  20. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/conf.py +0 -0
  21. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/contribution.rst +0 -0
  22. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/faq.rst +0 -0
  23. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/generate_rst.py +0 -0
  24. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/index.rst +0 -0
  25. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/infras.rst +0 -0
  26. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/quickstart.rst +0 -0
  27. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/sharpbits.rst +0 -0
  28. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/textbooktoc.rst +0 -0
  29. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/tutorial.rst +0 -0
  30. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/tutorial_cn.rst +0 -0
  31. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/whitepapertoc.rst +0 -0
  32. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/docs/source/whitepapertoc_cn.rst +0 -0
  33. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/setup.cfg +0 -0
  34. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/setup.py +0 -0
  35. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/about.py +0 -0
  36. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/abstractcircuit.py +0 -0
  37. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/__init__.py +0 -0
  38. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/ai/__init__.py +0 -0
  39. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/ai/ensemble.py +0 -0
  40. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/dqas.py +0 -0
  41. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/finance/__init__.py +0 -0
  42. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/finance/portfolio.py +0 -0
  43. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/graphdata.py +0 -0
  44. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/layers.py +0 -0
  45. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/optimization.py +0 -0
  46. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/physics/__init__.py +0 -0
  47. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/physics/baseline.py +0 -0
  48. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/physics/fss.py +0 -0
  49. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/utils.py +0 -0
  50. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/vags.py +0 -0
  51. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/van.py +0 -0
  52. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/applications/vqes.py +0 -0
  53. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/asciiart.py +0 -0
  54. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/__init__.py +0 -0
  55. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/backend_factory.py +0 -0
  56. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/cupy_backend.py +0 -0
  57. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/jax_backend.py +0 -0
  58. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/jax_ops.py +0 -0
  59. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/numpy_backend.py +0 -0
  60. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/pytorch_backend.py +0 -0
  61. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/pytorch_ops.py +0 -0
  62. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/backends/tf_ops.py +0 -0
  63. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/basecircuit.py +0 -0
  64. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/channels.py +0 -0
  65. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/circuit.py +0 -0
  66. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/__init__.py +0 -0
  67. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/abstraction.py +0 -0
  68. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/apis.py +0 -0
  69. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/config.py +0 -0
  70. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/local.py +0 -0
  71. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/quafu_provider.py +0 -0
  72. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/tencent.py +0 -0
  73. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/utils.py +0 -0
  74. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cloud/wrapper.py +0 -0
  75. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/compiler/__init__.py +0 -0
  76. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/compiler/composed_compiler.py +0 -0
  77. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/compiler/qiskit_compiler.py +0 -0
  78. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/compiler/simple_compiler.py +0 -0
  79. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/cons.py +0 -0
  80. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/densitymatrix.py +0 -0
  81. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/fgs.py +0 -0
  82. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/gates.py +0 -0
  83. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/__init__.py +0 -0
  84. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/jax.py +0 -0
  85. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/numpy.py +0 -0
  86. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/scipy.py +0 -0
  87. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/tensorflow.py +0 -0
  88. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/tensortrans.py +0 -0
  89. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/interfaces/torch.py +0 -0
  90. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/keras.py +0 -0
  91. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/mps_base.py +0 -0
  92. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/mpscircuit.py +0 -0
  93. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/noisemodel.py +0 -0
  94. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/quantum.py +0 -0
  95. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/__init__.py +0 -0
  96. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/counts.py +0 -0
  97. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/qem/__init__.py +0 -0
  98. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/qem/benchmark_circuits.py +0 -0
  99. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/qem/qem_methods.py +0 -0
  100. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/results/readout_mitigation.py +0 -0
  101. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/shadows.py +0 -0
  102. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/simplify.py +0 -0
  103. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/stabilizercircuit.py +0 -0
  104. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/__init__.py +0 -0
  105. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/ansatz.py +0 -0
  106. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/blocks.py +0 -0
  107. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/chems.py +0 -0
  108. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/conversions.py +0 -0
  109. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/dataset.py +0 -0
  110. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/graphs.py +0 -0
  111. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/hamiltonians.py +0 -0
  112. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/lattice.py +0 -0
  113. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/templates/measurements.py +0 -0
  114. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/torchnn.py +0 -0
  115. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/translation.py +0 -0
  116. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/utils.py +0 -0
  117. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit/vis.py +0 -0
  118. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit_nightly.egg-info/dependency_links.txt +0 -0
  119. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit_nightly.egg-info/requires.txt +0 -0
  120. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tensorcircuit_nightly.egg-info/top_level.txt +0 -0
  121. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/__init__.py +0 -0
  122. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/conftest.py +0 -0
  123. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_backends.py +0 -0
  124. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_calibrating.py +0 -0
  125. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_channels.py +0 -0
  126. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_circuit.py +0 -0
  127. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_cloud.py +0 -0
  128. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_compiler.py +0 -0
  129. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_dmcircuit.py +0 -0
  130. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_ensemble.py +0 -0
  131. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_fgs.py +0 -0
  132. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_gates.py +0 -0
  133. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_hamiltonians.py +0 -0
  134. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_interfaces.py +0 -0
  135. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_keras.py +0 -0
  136. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_lattice.py +0 -0
  137. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_mpscircuit.py +0 -0
  138. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_noisemodel.py +0 -0
  139. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_qaoa.py +0 -0
  140. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_qem.py +0 -0
  141. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_quantum.py +0 -0
  142. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_quantum_attr.py +0 -0
  143. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_results.py +0 -0
  144. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_shadows.py +0 -0
  145. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_simplify.py +0 -0
  146. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_stabilizer.py +0 -0
  147. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_templates.py +0 -0
  148. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_torchnn.py +0 -0
  149. {tensorcircuit_nightly-1.3.0.dev20250727 → tensorcircuit_nightly-1.3.0.dev20250729}/tests/test_van.py +0 -0
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Added
6
+
7
+ - Add new module `tc.timeevol` for different types of time evolution solvers.
8
+
5
9
  ## v1.3.0
6
10
 
7
11
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensorcircuit-nightly
3
- Version: 1.3.0.dev20250727
3
+ Version: 1.3.0.dev20250729
4
4
  Summary: nightly release for tensorcircuit
5
5
  Home-page: https://github.com/refraction-ray/tensorcircuit-dev
6
6
  Author: TensorCircuit Authors
@@ -70,7 +70,7 @@ TensorCircuit-NG is the actively maintained official version and a [fully compat
70
70
 
71
71
  Please begin with [Quick Start](/docs/source/quickstart.rst) in the [full documentation](https://tensorcircuit-ng.readthedocs.io/).
72
72
 
73
- For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to tensorcircuit-ng [deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) or [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
73
+ For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to AI-native docs for tensorcircuit-ng: [Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) and [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
74
74
 
75
75
  For beginners, please refer to [quantum computing lectures with TC-NG](https://github.com/sxzgroup/qc_lecture) to learn both quantum computing basics and representative usage of TensorCircuit-NG.
76
76
 
@@ -35,7 +35,7 @@ TensorCircuit-NG is the actively maintained official version and a [fully compat
35
35
 
36
36
  Please begin with [Quick Start](/docs/source/quickstart.rst) in the [full documentation](https://tensorcircuit-ng.readthedocs.io/).
37
37
 
38
- For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to tensorcircuit-ng [deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) or [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
38
+ For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to AI-native docs for tensorcircuit-ng: [Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) and [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
39
39
 
40
40
  For beginners, please refer to [quantum computing lectures with TC-NG](https://github.com/sxzgroup/qc_lecture) to learn both quantum computing basics and representative usage of TensorCircuit-NG.
41
41
 
@@ -21,11 +21,13 @@
21
21
 
22
22
  <p align="center"> <a href="README.md">English</a> | 简体中文 </p>
23
23
 
24
- TensorCircuit-NG 是下一代量子软件框架,完美支持自动微分、即时编译、硬件加速和向量并行化。
24
+ TensorCircuit-NG 是下一代量子软件框架,完美支持自动微分、即时编译、硬件加速、向量并行化和分布式训练。
25
25
 
26
- TensorCircuit-NG 建立在现代机器学习框架 Jax, TensorFlow, PyTorch 之上,支持机器学习后端无关的统一界面。 其特别适用于理想情况、含噪声情况、稳定子情况及可控近似情况下,大规模量子经典混合范式和变分量子算法的高效模拟。
26
+ TensorCircuit-NG 建立在现代机器学习框架 Jax, TensorFlow, PyTorch 之上,支持机器学习后端无关的统一界面。 其特别适用于理想情况、含噪声情况、稳定子情况、可控近似情况、连续动力学情况及费米子情况下,大规模量子经典混合范式和变分量子算法的高效模拟。其可以高效地编织和模拟量子线路、张量网络和神经网络组成的混合计算图。
27
27
 
28
- TensorCircuit-NG 现在支持真实量子硬件连接和实验,并提供优雅的 CPU/GPU/QPU 混合部署训练方案(v0.9+)。
28
+ TensorCircuit-NG 现在支持真实量子硬件连接和实验,并提供优雅的 CPU/GPU/QPU 硬件混合部署训练方案。
29
+
30
+ TensorCircuit-NG 是目前积极维护的唯一官方版本,是 TensorCircuit 的[完全兼容](https://github.com/orgs/tensorcircuit/discussions/19)的升级版本,它包含了更多新功能(例如稳定子线路、多卡分布式模拟等)和错误修复(例如支持最新的 numpy>2 和 qiskit>1)。
29
31
 
30
32
  ## 入门
31
33
 
@@ -33,6 +35,8 @@ TensorCircuit-NG 现在支持真实量子硬件连接和实验,并提供优雅
33
35
 
34
36
  有关软件用法,算法实现和工程范式演示的更多信息和介绍,请参阅 80+ [示例脚本](/examples) 和 30+ [案例教程](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials)。 [测试](/tests) 用例和 API docstring 也提供了丰富的使用信息。
35
37
 
38
+ TensorCircuit-NG 也支持 AI 原生编程资源:[Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) 和 [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
39
+
36
40
  初学者也可以参考[量子计算教程](https://github.com/sxzgroup/qc_lecture)学习量子计算基础和 TensorCircuit-NG 的典型用法.
37
41
 
38
42
  以下是一些最简易的演示。
@@ -26,6 +26,7 @@ tensorcircuit
26
26
  ./api/simplify.rst
27
27
  ./api/stabilizercircuit.rst
28
28
  ./api/templates.rst
29
+ ./api/timeevol.rst
29
30
  ./api/torchnn.rst
30
31
  ./api/translation.rst
31
32
  ./api/utils.rst
@@ -1,4 +1,4 @@
1
- __version__ = "1.3.0.dev20250727"
1
+ __version__ = "1.3.0.dev20250729"
2
2
  __author__ = "TensorCircuit Authors"
3
3
  __creator__ = "refraction-ray"
4
4
 
@@ -52,6 +52,7 @@ from . import compiler
52
52
  from . import cloud
53
53
  from . import fgs
54
54
  from .fgs import FGSSimulator
55
+ from . import timeevol
55
56
 
56
57
  FGSCircuit = FGSSimulator
57
58
 
@@ -700,6 +700,9 @@ class ExtendedBackend:
700
700
  "Backend '{}' has not implemented `is_tensor`.".format(self.name)
701
701
  )
702
702
 
703
+ def matvec(self: Any, A: Tensor, x: Tensor) -> Tensor:
704
+ return self.tensordot(A, x, axes=[[1], [0]])
705
+
703
706
  def cast(self: Any, a: Tensor, dtype: str) -> Tensor:
704
707
  """
705
708
  Cast the tensor dtype of a ``a``.
@@ -678,7 +678,14 @@ class TensorFlowBackend(tensorflow_backend.TensorFlowBackend, ExtendedBackend):
678
678
  sp_a: Tensor,
679
679
  b: Tensor,
680
680
  ) -> Tensor:
681
- return tf.sparse.sparse_dense_matmul(sp_a, b)
681
+ is_vec = False
682
+ if len(b.shape) == 1:
683
+ b = self.reshape(b, [-1, 1])
684
+ is_vec = True
685
+ r = tf.sparse.sparse_dense_matmul(sp_a, b)
686
+ if is_vec:
687
+ return self.reshape(r, [-1])
688
+ return r
682
689
 
683
690
  def _densify(self) -> Tensor:
684
691
  @partial(self.jit, jit_compile=True)
@@ -2,14 +2,20 @@
2
2
  Experimental features
3
3
  """
4
4
 
5
+ # pylint: disable=unused-import
6
+
5
7
  from functools import partial
6
8
  import logging
7
9
  from typing import Any, Callable, Dict, Optional, Tuple, List, Sequence, Union
8
10
 
9
11
  import numpy as np
10
12
 
11
- from .cons import backend, dtypestr, contractor, rdtypestr, get_tn_info
13
+ from .cons import backend, dtypestr, rdtypestr, get_tn_info
12
14
  from .gates import Gate
15
+ from .timeevol import hamiltonian_evol, evol_global, evol_local
16
+
17
+
18
+ # for backward compatibility
13
19
 
14
20
  Tensor = Any
15
21
  Circuit = Any
@@ -435,157 +441,6 @@ def finite_difference_differentiator(
435
441
  return tf_function # type: ignore
436
442
 
437
443
 
438
- def hamiltonian_evol(
439
- tlist: Tensor,
440
- h: Tensor,
441
- psi0: Tensor,
442
- callback: Optional[Callable[..., Any]] = None,
443
- ) -> Tensor:
444
- """
445
- Fast implementation of time independent Hamiltonian evolution using eigendecomposition.
446
- By default, performs imaginary time evolution.
447
-
448
- :param tlist: Time points for evolution
449
- :type tlist: Tensor
450
- :param h: Time-independent Hamiltonian matrix
451
- :type h: Tensor
452
- :param psi0: Initial state vector
453
- :type psi0: Tensor
454
- :param callback: Optional function to process state at each time point
455
- :type callback: Optional[Callable[..., Any]], optional
456
- :return: Evolution results at each time point. If callback is None, returns state vectors;
457
- otherwise returns callback results
458
- :rtype: Tensor
459
-
460
- :Example:
461
-
462
- >>> import tensorcircuit as tc
463
- >>> import numpy as np
464
- >>> # Define a simple 2-qubit Hamiltonian
465
- >>> h = tc.array_to_tensor([
466
- ... [1.0, 0.0, 0.0, 0.0],
467
- ... [0.0, -1.0, 2.0, 0.0],
468
- ... [0.0, 2.0, -1.0, 0.0],
469
- ... [0.0, 0.0, 0.0, 1.0]
470
- ... ])
471
- >>> # Initial state |00⟩
472
- >>> psi0 = tc.array_to_tensor([1.0, 0.0, 0.0, 0.0])
473
- >>> # Evolution times
474
- >>> times = tc.array_to_tensor([0.0, 0.5, 1.0])
475
- >>> # Evolve and get states
476
- >>> states = tc.experimental.hamiltonian_evol(times, h, psi0)
477
- >>> print(states.shape) # (3, 4)
478
-
479
-
480
- Note:
481
- 1. The Hamiltonian must be time-independent
482
- 2. For time-dependent Hamiltonians, use ``evol_local`` or ``evol_global`` instead
483
- 3. The evolution is performed in imaginary time by default (factor -t in exponential)
484
- 4. The state is automatically normalized at each time point
485
- """
486
- es, u = backend.eigh(h)
487
- utpsi0 = backend.reshape(
488
- backend.transpose(u) @ backend.reshape(psi0, [-1, 1]), [-1]
489
- )
490
-
491
- @backend.jit
492
- def _evol(t: Tensor) -> Tensor:
493
- ebetah_utpsi0 = backend.exp(-t * es) * utpsi0
494
- psi_exact = backend.conj(u) @ backend.reshape(ebetah_utpsi0, [-1, 1])
495
- psi_exact = backend.reshape(psi_exact, [-1])
496
- psi_exact = psi_exact / backend.norm(psi_exact)
497
- if callback is None:
498
- return psi_exact
499
- return callback(psi_exact)
500
-
501
- return backend.stack([_evol(t) for t in tlist])
502
-
503
-
504
- def evol_local(
505
- c: Circuit,
506
- index: Sequence[int],
507
- h_fun: Callable[..., Tensor],
508
- t: float,
509
- *args: Any,
510
- **solver_kws: Any,
511
- ) -> Circuit:
512
- """
513
- ode evolution of time dependent Hamiltonian on circuit of given indices
514
- [only jax backend support for now]
515
-
516
- :param c: _description_
517
- :type c: Circuit
518
- :param index: qubit sites to evolve
519
- :type index: Sequence[int]
520
- :param h_fun: h_fun should return a dense Hamiltonian matrix
521
- with input arguments time and *args
522
- :type h_fun: Callable[..., Tensor]
523
- :param t: evolution time
524
- :type t: float
525
- :return: _description_
526
- :rtype: Circuit
527
- """
528
- from jax.experimental.ode import odeint
529
-
530
- s = c.state()
531
- n = c._nqubits
532
- l = len(index)
533
-
534
- def f(y: Tensor, t: Tensor, *args: Any) -> Tensor:
535
- y = backend.reshape2(y)
536
- y = Gate(y)
537
- h = -1.0j * h_fun(t, *args)
538
- h = backend.reshape2(h)
539
- h = Gate(h)
540
- edges = []
541
- for i in range(n):
542
- if i not in index:
543
- edges.append(y[i])
544
- else:
545
- j = index.index(i)
546
- edges.append(h[j])
547
- h[j + l] ^ y[i]
548
- y = contractor([y, h], output_edge_order=edges)
549
- return backend.reshape(y.tensor, [-1])
550
-
551
- ts = backend.stack([0.0, t])
552
- ts = backend.cast(ts, dtype=rdtypestr)
553
- s1 = odeint(f, s, ts, *args, **solver_kws)
554
- return type(c)(n, inputs=s1[-1])
555
-
556
-
557
- def evol_global(
558
- c: Circuit, h_fun: Callable[..., Tensor], t: float, *args: Any, **solver_kws: Any
559
- ) -> Circuit:
560
- """
561
- ode evolution of time dependent Hamiltonian on circuit of all qubits
562
- [only jax backend support for now]
563
-
564
- :param c: _description_
565
- :type c: Circuit
566
- :param h_fun: h_fun should return a **SPARSE** Hamiltonian matrix
567
- with input arguments time and *args
568
- :type h_fun: Callable[..., Tensor]
569
- :param t: _description_
570
- :type t: float
571
- :return: _description_
572
- :rtype: Circuit
573
- """
574
- from jax.experimental.ode import odeint
575
-
576
- s = c.state()
577
- n = c._nqubits
578
-
579
- def f(y: Tensor, t: Tensor, *args: Any) -> Tensor:
580
- h = -1.0j * h_fun(t, *args)
581
- return backend.sparse_dense_matmul(h, y)
582
-
583
- ts = backend.stack([0.0, t])
584
- ts = backend.cast(ts, dtype=rdtypestr)
585
- s1 = odeint(f, s, ts, *args, **solver_kws)
586
- return type(c)(n, inputs=s1[-1])
587
-
588
-
589
444
  def jax_jitted_function_save(filename: str, f: Callable[..., Any], *args: Any) -> None:
590
445
  """
591
446
  save a jitted jax function as a file
@@ -0,0 +1,346 @@
1
+ """
2
+ Analog time evolution engines
3
+ """
4
+
5
+ from typing import Any, Tuple, Optional, Callable, List, Sequence
6
+
7
+ from .cons import backend, dtypestr, rdtypestr, contractor
8
+ from .gates import Gate
9
+
10
+ Tensor = Any
11
+ Circuit = Any
12
+
13
+
14
+ def lanczos_iteration(
15
+ hamiltonian: Tensor, initial_vector: Tensor, subspace_dimension: int
16
+ ) -> Tuple[Tensor, Tensor]:
17
+ """
18
+ Use Lanczos algorithm to construct orthogonal basis and projected Hamiltonian
19
+ of Krylov subspace.
20
+
21
+ :param hamiltonian: Sparse or dense Hamiltonian matrix
22
+ :type hamiltonian: Tensor
23
+ :param initial_vector: Initial quantum state vector
24
+ :type initial_vector: Tensor
25
+ :param subspace_dimension: Dimension of Krylov subspace
26
+ :type subspace_dimension: int
27
+ :return: Tuple containing (basis matrix, projected Hamiltonian)
28
+ :rtype: Tuple[Tensor, Tensor]
29
+ """
30
+ # Initialize
31
+ vector = initial_vector
32
+ vector = backend.cast(vector, dtypestr)
33
+
34
+ # Use list to store basis vectors
35
+ basis_vectors: List[Any] = []
36
+
37
+ # Store alpha and beta coefficients for constructing tridiagonal matrix
38
+ alphas = []
39
+ betas = []
40
+
41
+ # Normalize initial vector
42
+ vector_norm = backend.norm(vector)
43
+ vector = vector / vector_norm
44
+
45
+ # Add first basis vector
46
+ basis_vectors.append(vector)
47
+
48
+ # Lanczos iteration (fixed number of iterations for JIT compatibility)
49
+ for j in range(subspace_dimension):
50
+ # Calculate H|v_j>
51
+ if backend.is_sparse(hamiltonian):
52
+ w = backend.sparse_dense_matmul(hamiltonian, vector)
53
+ else:
54
+ w = backend.matvec(hamiltonian, vector)
55
+
56
+ # Calculate alpha_j = <v_j|H|v_j>
57
+ alpha = backend.real(backend.sum(backend.conj(vector) * w))
58
+ alphas.append(alpha)
59
+
60
+ # w = H|v_j> - alpha_j|v_j> - beta_{j-1}|v_{j-1}>
61
+ # is not sufficient, require re-normalization
62
+ w = w - backend.cast(alpha, dtypestr) * vector
63
+
64
+ for k in range(j + 1):
65
+ v_k = basis_vectors[k]
66
+ projection = backend.sum(backend.conj(v_k) * w)
67
+ w = w - projection * v_k
68
+
69
+ # if j > 0:
70
+ # w = w - prev_beta * basis_vectors[-2]
71
+
72
+ # Calculate beta_{j+1} = ||w||
73
+ beta = backend.norm(w)
74
+ betas.append(beta)
75
+
76
+ # Use regularization technique to avoid division by zero error,
77
+ # adding small epsilon value to ensure numerical stability
78
+ epsilon = 1e-15
79
+ norm_factor = 1.0 / (beta + epsilon)
80
+
81
+ # Normalize w to get |v_{j+1}> (except for the last iteration)
82
+ if j < subspace_dimension - 1:
83
+ vector = w * backend.cast(norm_factor, dtypestr)
84
+ basis_vectors.append(vector)
85
+
86
+ # Construct final basis matrix
87
+ basis_matrix = backend.stack(basis_vectors, axis=1)
88
+
89
+ # Construct tridiagonal projected Hamiltonian
90
+ # Use vectorized method to construct tridiagonal matrix at once
91
+ alphas_tensor = backend.stack(alphas)
92
+ # Only use first krylov_dim-1 beta values to construct off-diagonal
93
+ betas_tensor = backend.stack(betas[:-1]) if len(betas) > 1 else backend.stack([])
94
+
95
+ # Convert to correct data type
96
+ alphas_tensor = backend.cast(alphas_tensor, dtype=dtypestr)
97
+ if len(betas_tensor) > 0:
98
+ betas_tensor = backend.cast(betas_tensor, dtype=dtypestr)
99
+
100
+ # Construct diagonal and off-diagonal parts
101
+ diag_part = backend.diagflat(alphas_tensor)
102
+ if len(betas_tensor) > 0:
103
+ off_diag_part = backend.diagflat(betas_tensor, k=1)
104
+ projected_hamiltonian = (
105
+ diag_part + off_diag_part + backend.transpose(off_diag_part)
106
+ )
107
+ else:
108
+ projected_hamiltonian = diag_part
109
+
110
+ return basis_matrix, projected_hamiltonian
111
+
112
+
113
+ def krylov_evol(
114
+ hamiltonian: Tensor,
115
+ initial_state: Tensor,
116
+ time_points: Tensor,
117
+ subspace_dimension: int,
118
+ callback: Optional[Callable[[Any], Any]] = None,
119
+ ) -> Any:
120
+ """
121
+ Perform quantum state time evolution using Krylov subspace method.
122
+
123
+ :param hamiltonian: Sparse or dense Hamiltonian matrix
124
+ :type hamiltonian: Tensor
125
+ :param initial_state: Initial quantum state
126
+ :type initial_state: Tensor
127
+ :param time_points: List of time points
128
+ :type time_points: Tensor
129
+ :param subspace_dimension: Krylov subspace dimension
130
+ :type subspace_dimension: int
131
+ :param callback: Optional callback function applied to quantum state at
132
+ each evolution time point, return some observables
133
+ :type callback: Optional[Callable[[Any], Any]], optional
134
+ :return: List of evolved quantum states, or list of callback function results
135
+ (if callback provided)
136
+ :rtype: Any
137
+ """
138
+ # TODO(@refraction-ray): stable and efficient AD is to be investigated
139
+ basis_matrix, projected_hamiltonian = lanczos_iteration(
140
+ hamiltonian, initial_state, subspace_dimension
141
+ )
142
+ initial_state = backend.cast(initial_state, dtypestr)
143
+ # Project initial state to Krylov subspace: |psi_proj> = V_m^† |psi(0)>
144
+ projected_state = backend.matvec(
145
+ backend.conj(backend.transpose(basis_matrix)), initial_state
146
+ )
147
+
148
+ # Perform spectral decomposition of projected Hamiltonian: T_m = U D U^†
149
+ eigenvalues, eigenvectors = backend.eigh(projected_hamiltonian)
150
+ eigenvalues = backend.cast(eigenvalues, dtypestr)
151
+ time_points = backend.convert_to_tensor(time_points)
152
+ time_points = backend.cast(time_points, dtypestr)
153
+
154
+ # Transform projected state to eigenbasis: |psi_coeff> = U^† |psi_proj>
155
+ eigenvectors_projected_state = backend.matvec(
156
+ backend.conj(backend.transpose(eigenvectors)), projected_state
157
+ )
158
+
159
+ # Calculate exp(-i*projected_H*t) * projected_state
160
+ results = []
161
+ for t in time_points:
162
+ # Calculate exp(-i*eigenvalues*t)
163
+ exp_diagonal = backend.exp(-1j * eigenvalues * t)
164
+
165
+ # Evolve state in eigenbasis: |psi_evolved_coeff> = exp(-i*D*t) |psi_coeff>
166
+ evolved_projected_coeff = exp_diagonal * eigenvectors_projected_state
167
+
168
+ # Transform back to eigenbasis: |psi_evolved_proj> = U |psi_evolved_coeff>
169
+ evolved_projected = backend.matvec(eigenvectors, evolved_projected_coeff)
170
+
171
+ # Transform back to original basis: |psi(t)> = V_m |psi_evolved_proj>
172
+ evolved_state = backend.matvec(basis_matrix, evolved_projected)
173
+
174
+ # Apply callback function if provided
175
+ if callback is not None:
176
+ result = callback(evolved_state)
177
+ else:
178
+ result = evolved_state
179
+
180
+ results.append(result)
181
+
182
+ return backend.stack(results)
183
+
184
+
185
+ def hamiltonian_evol(
186
+ tlist: Tensor,
187
+ h: Tensor,
188
+ psi0: Tensor,
189
+ callback: Optional[Callable[..., Any]] = None,
190
+ ) -> Tensor:
191
+ """
192
+ Fast implementation of time independent Hamiltonian evolution using eigendecomposition.
193
+ By default, performs imaginary time evolution.
194
+
195
+ :param tlist: Time points for evolution
196
+ :type tlist: Tensor
197
+ :param h: Time-independent Hamiltonian matrix
198
+ :type h: Tensor
199
+ :param psi0: Initial state vector
200
+ :type psi0: Tensor
201
+ :param callback: Optional function to process state at each time point
202
+ :type callback: Optional[Callable[..., Any]], optional
203
+ :return: Evolution results at each time point. If callback is None, returns state vectors;
204
+ otherwise returns callback results
205
+ :rtype: Tensor
206
+
207
+ :Example:
208
+
209
+ >>> import tensorcircuit as tc
210
+ >>> import numpy as np
211
+ >>> # Define a simple 2-qubit Hamiltonian
212
+ >>> h = tc.array_to_tensor([
213
+ ... [1.0, 0.0, 0.0, 0.0],
214
+ ... [0.0, -1.0, 2.0, 0.0],
215
+ ... [0.0, 2.0, -1.0, 0.0],
216
+ ... [0.0, 0.0, 0.0, 1.0]
217
+ ... ])
218
+ >>> # Initial state |00⟩
219
+ >>> psi0 = tc.array_to_tensor([1.0, 0.0, 0.0, 0.0])
220
+ >>> # Evolution times
221
+ >>> times = tc.array_to_tensor([0.0, 0.5, 1.0])
222
+ >>> # Evolve and get states
223
+ >>> states = tc.experimental.hamiltonian_evol(times, h, psi0)
224
+ >>> print(states.shape) # (3, 4)
225
+
226
+
227
+ Note:
228
+ 1. The Hamiltonian must be time-independent
229
+ 2. For time-dependent Hamiltonians, use ``evol_local`` or ``evol_global`` instead
230
+ 3. The evolution is performed in imaginary time by default (factor -t in exponential)
231
+ 4. The state is automatically normalized at each time point
232
+ """
233
+ psi0 = backend.cast(psi0, dtypestr)
234
+ es, u = backend.eigh(h)
235
+ u = backend.cast(u, dtypestr)
236
+ utpsi0 = backend.reshape(
237
+ backend.transpose(u) @ backend.reshape(psi0, [-1, 1]), [-1]
238
+ )
239
+ es = backend.cast(es, dtypestr)
240
+ tlist = backend.cast(backend.convert_to_tensor(tlist), dtypestr)
241
+
242
+ @backend.jit
243
+ def _evol(t: Tensor) -> Tensor:
244
+ ebetah_utpsi0 = backend.exp(-t * es) * utpsi0
245
+ psi_exact = backend.conj(u) @ backend.reshape(ebetah_utpsi0, [-1, 1])
246
+ psi_exact = backend.reshape(psi_exact, [-1])
247
+ psi_exact = psi_exact / backend.norm(psi_exact)
248
+ if callback is None:
249
+ return psi_exact
250
+ return callback(psi_exact)
251
+
252
+ return backend.stack([_evol(t) for t in tlist])
253
+
254
+
255
+ ed_evol = hamiltonian_evol
256
+
257
+
258
+ def evol_local(
259
+ c: Circuit,
260
+ index: Sequence[int],
261
+ h_fun: Callable[..., Tensor],
262
+ t: float,
263
+ *args: Any,
264
+ **solver_kws: Any,
265
+ ) -> Circuit:
266
+ """
267
+ ode evolution of time dependent Hamiltonian on circuit of given indices
268
+ [only jax backend support for now]
269
+
270
+ :param c: _description_
271
+ :type c: Circuit
272
+ :param index: qubit sites to evolve
273
+ :type index: Sequence[int]
274
+ :param h_fun: h_fun should return a dense Hamiltonian matrix
275
+ with input arguments time and *args
276
+ :type h_fun: Callable[..., Tensor]
277
+ :param t: evolution time
278
+ :type t: float
279
+ :return: _description_
280
+ :rtype: Circuit
281
+ """
282
+ from jax.experimental.ode import odeint
283
+
284
+ s = c.state()
285
+ n = c._nqubits
286
+ l = len(index)
287
+
288
+ def f(y: Tensor, t: Tensor, *args: Any) -> Tensor:
289
+ y = backend.reshape2(y)
290
+ y = Gate(y)
291
+ h = -1.0j * h_fun(t, *args)
292
+ h = backend.reshape2(h)
293
+ h = Gate(h)
294
+ edges = []
295
+ for i in range(n):
296
+ if i not in index:
297
+ edges.append(y[i])
298
+ else:
299
+ j = index.index(i)
300
+ edges.append(h[j])
301
+ h[j + l] ^ y[i]
302
+ y = contractor([y, h], output_edge_order=edges)
303
+ return backend.reshape(y.tensor, [-1])
304
+
305
+ ts = backend.stack([0.0, t])
306
+ ts = backend.cast(ts, dtype=rdtypestr)
307
+ s1 = odeint(f, s, ts, *args, **solver_kws)
308
+ return type(c)(n, inputs=s1[-1])
309
+
310
+
311
+ ode_evol_local = evol_local
312
+
313
+
314
+ def evol_global(
315
+ c: Circuit, h_fun: Callable[..., Tensor], t: float, *args: Any, **solver_kws: Any
316
+ ) -> Circuit:
317
+ """
318
+ ode evolution of time dependent Hamiltonian on circuit of all qubits
319
+ [only jax backend support for now]
320
+
321
+ :param c: _description_
322
+ :type c: Circuit
323
+ :param h_fun: h_fun should return a **SPARSE** Hamiltonian matrix
324
+ with input arguments time and *args
325
+ :type h_fun: Callable[..., Tensor]
326
+ :param t: _description_
327
+ :type t: float
328
+ :return: _description_
329
+ :rtype: Circuit
330
+ """
331
+ from jax.experimental.ode import odeint
332
+
333
+ s = c.state()
334
+ n = c._nqubits
335
+
336
+ def f(y: Tensor, t: Tensor, *args: Any) -> Tensor:
337
+ h = -1.0j * h_fun(t, *args)
338
+ return backend.sparse_dense_matmul(h, y)
339
+
340
+ ts = backend.stack([0.0, t])
341
+ ts = backend.cast(ts, dtype=rdtypestr)
342
+ s1 = odeint(f, s, ts, *args, **solver_kws)
343
+ return type(c)(n, inputs=s1[-1])
344
+
345
+
346
+ ode_evol_global = evol_global
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensorcircuit-nightly
3
- Version: 1.3.0.dev20250727
3
+ Version: 1.3.0.dev20250729
4
4
  Summary: nightly release for tensorcircuit
5
5
  Home-page: https://github.com/refraction-ray/tensorcircuit-dev
6
6
  Author: TensorCircuit Authors
@@ -70,7 +70,7 @@ TensorCircuit-NG is the actively maintained official version and a [fully compat
70
70
 
71
71
  Please begin with [Quick Start](/docs/source/quickstart.rst) in the [full documentation](https://tensorcircuit-ng.readthedocs.io/).
72
72
 
73
- For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to tensorcircuit-ng [deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) or [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
73
+ For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 80+ [example scripts](/examples) and 30+ [tutorial notebooks](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials). API docstrings and test cases in [tests](/tests) are also informative. One can also refer to AI-native docs for tensorcircuit-ng: [Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) and [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
74
74
 
75
75
  For beginners, please refer to [quantum computing lectures with TC-NG](https://github.com/sxzgroup/qc_lecture) to learn both quantum computing basics and representative usage of TensorCircuit-NG.
76
76
 
@@ -41,6 +41,7 @@ tensorcircuit/quantum.py
41
41
  tensorcircuit/shadows.py
42
42
  tensorcircuit/simplify.py
43
43
  tensorcircuit/stabilizercircuit.py
44
+ tensorcircuit/timeevol.py
44
45
  tensorcircuit/torchnn.py
45
46
  tensorcircuit/translation.py
46
47
  tensorcircuit/utils.py
@@ -141,5 +142,6 @@ tests/test_shadows.py
141
142
  tests/test_simplify.py
142
143
  tests/test_stabilizer.py
143
144
  tests/test_templates.py
145
+ tests/test_timeevol.py
144
146
  tests/test_torchnn.py
145
147
  tests/test_van.py