tensorcircuit-nightly 1.2.1.dev20250726__tar.gz → 1.3.0.dev20250727__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.
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/CHANGELOG.md +8 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/PKG-INFO +2 -2
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/README.md +1 -1
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/tutorial.rst +3 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/__init__.py +1 -1
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/fgs.py +3 -2
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/counts.py +99 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/stabilizercircuit.py +0 -1
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/__init__.py +1 -0
- tensorcircuit_nightly-1.3.0.dev20250727/tensorcircuit/templates/hamiltonians.py +153 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/utils.py +7 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit_nightly.egg-info/PKG-INFO +2 -2
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit_nightly.egg-info/SOURCES.txt +2 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_fgs.py +8 -0
- tensorcircuit_nightly-1.3.0.dev20250727/tests/test_hamiltonians.py +159 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/HISTORY.md +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/LICENSE +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/MANIFEST.in +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/README_cn.md +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/advance.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/cnconf.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/conf.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/contribution.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/faq.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/generate_rst.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/index.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/infras.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/modules.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/quickstart.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/sharpbits.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/textbooktoc.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/tutorial_cn.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/whitepapertoc.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/docs/source/whitepapertoc_cn.rst +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/setup.cfg +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/setup.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/about.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/abstractcircuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/ai/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/ai/ensemble.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/dqas.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/finance/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/finance/portfolio.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/graphdata.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/layers.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/optimization.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/physics/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/physics/baseline.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/physics/fss.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/utils.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/vags.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/van.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/applications/vqes.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/asciiart.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/abstract_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/backend_factory.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/cupy_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/jax_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/jax_ops.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/numpy_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/pytorch_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/pytorch_ops.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/tensorflow_backend.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/backends/tf_ops.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/basecircuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/channels.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/circuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/abstraction.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/apis.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/config.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/local.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/quafu_provider.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/tencent.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/utils.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cloud/wrapper.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/compiler/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/compiler/composed_compiler.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/compiler/qiskit_compiler.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/compiler/simple_compiler.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/cons.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/densitymatrix.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/experimental.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/gates.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/jax.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/numpy.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/scipy.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/tensorflow.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/tensortrans.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/interfaces/torch.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/keras.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/mps_base.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/mpscircuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/noisemodel.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/quantum.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/qem/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/qem/benchmark_circuits.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/qem/qem_methods.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/results/readout_mitigation.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/shadows.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/simplify.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/ansatz.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/blocks.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/chems.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/conversions.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/dataset.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/graphs.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/lattice.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/templates/measurements.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/torchnn.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/translation.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit/vis.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit_nightly.egg-info/dependency_links.txt +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit_nightly.egg-info/requires.txt +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tensorcircuit_nightly.egg-info/top_level.txt +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/__init__.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/conftest.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_backends.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_calibrating.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_channels.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_circuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_cloud.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_compiler.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_dmcircuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_ensemble.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_gates.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_interfaces.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_keras.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_lattice.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_miscs.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_mpscircuit.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_noisemodel.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_qaoa.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_qem.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_quantum.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_quantum_attr.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_results.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_shadows.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_simplify.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_stabilizer.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_templates.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_torchnn.py +0 -0
- {tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/tests/test_van.py +0 -0
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/CHANGELOG.md
RENAMED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## v1.3.0
|
|
6
|
+
|
|
5
7
|
### Added
|
|
6
8
|
|
|
7
9
|
- Add `Lattice` module (`tensorcircuit.templates.lattice`) for creating and manipulating various lattice geometries, including `SquareLattice`, `HoneycombLattice`, and `CustomizeLattice`.
|
|
8
10
|
|
|
11
|
+
- Add `tc.templates.hamiltonians` for commom systems.
|
|
12
|
+
|
|
9
13
|
- Add `DistributedContractor` in experimental module with new examples for fast implementation of distribution circuit simulation on jax backend.
|
|
10
14
|
|
|
11
15
|
- Add `circuit.amplitude_before()` method to return the corresponding tensornetwork nodes.
|
|
@@ -20,6 +24,10 @@
|
|
|
20
24
|
|
|
21
25
|
- Fix `to_dlpack` for jax version >= 0.7.
|
|
22
26
|
|
|
27
|
+
- Fix large eps issue in entanglement calculation of FGS.
|
|
28
|
+
|
|
29
|
+
- Fix cmatrix non-refresh issue for `post_select` in FGS.
|
|
30
|
+
|
|
23
31
|
## v1.2.1
|
|
24
32
|
|
|
25
33
|
### Fixed
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorcircuit-nightly
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0.dev20250727
|
|
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)
|
|
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).
|
|
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
|
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/README.md
RENAMED
|
@@ -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)
|
|
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).
|
|
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
|
|
|
@@ -18,6 +18,8 @@ Jupyter Tutorials
|
|
|
18
18
|
tutorials/mera.ipynb
|
|
19
19
|
tutorials/gradient_benchmark.ipynb
|
|
20
20
|
tutorials/contractors.ipynb
|
|
21
|
+
tutorials/stabilizer_circuit.ipynb
|
|
22
|
+
tutorials/fermion_gaussian_states.ipynb
|
|
21
23
|
tutorials/operator_spreading.ipynb
|
|
22
24
|
tutorials/optimization_and_expressibility.ipynb
|
|
23
25
|
tutorials/vqex_mbl.ipynb
|
|
@@ -28,4 +30,5 @@ Jupyter Tutorials
|
|
|
28
30
|
tutorials/imag_time_evo.ipynb
|
|
29
31
|
tutorials/classical_shadows.ipynb
|
|
30
32
|
tutorials/sklearn_svc.ipynb
|
|
33
|
+
tutorials/distributed_simulation.ipynb
|
|
31
34
|
tutorials/qcloud_sdk_demo.ipynb
|
|
@@ -310,7 +310,7 @@ class FGSSimulator:
|
|
|
310
310
|
lbd, _ = backend.eigh(m)
|
|
311
311
|
lbd = backend.real(lbd)
|
|
312
312
|
lbd = backend.relu(lbd)
|
|
313
|
-
eps = 1e-
|
|
313
|
+
eps = 1e-9
|
|
314
314
|
|
|
315
315
|
entropy = backend.sum(backend.log(lbd**n + (1 - lbd) ** n + eps))
|
|
316
316
|
s = 1 / (2 * (1 - n)) * entropy
|
|
@@ -449,7 +449,7 @@ class FGSSimulator:
|
|
|
449
449
|
lbd = backend.real(lbd)
|
|
450
450
|
lbd = backend.relu(lbd)
|
|
451
451
|
# lbd /= backend.sum(lbd)
|
|
452
|
-
eps = 1e-
|
|
452
|
+
eps = 1e-9
|
|
453
453
|
entropy = -backend.sum(
|
|
454
454
|
lbd * backend.log(lbd + eps) + (1 - lbd) * backend.log(1 - lbd + eps)
|
|
455
455
|
)
|
|
@@ -793,6 +793,7 @@ class FGSSimulator:
|
|
|
793
793
|
alpha1 = alpha1 * mask02d + backend.tile(newcol[:, None], [1, self.L]) * mask12d
|
|
794
794
|
q, _ = backend.qr(alpha1)
|
|
795
795
|
self.alpha = q
|
|
796
|
+
self.cmatrix = None
|
|
796
797
|
|
|
797
798
|
def cond_measure(self, ind: int, status: float, with_prob: bool = False) -> Tensor:
|
|
798
799
|
"""
|
|
@@ -12,6 +12,19 @@ ct = Dict[str, int]
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def reverse_count(count: ct) -> ct:
|
|
15
|
+
"""
|
|
16
|
+
Reverse the bit string keys in a count dictionary.
|
|
17
|
+
|
|
18
|
+
:param count: A dictionary mapping bit strings to counts
|
|
19
|
+
:type count: ct
|
|
20
|
+
:return: A new dictionary with reversed bit string keys
|
|
21
|
+
:rtype: ct
|
|
22
|
+
|
|
23
|
+
:Example:
|
|
24
|
+
|
|
25
|
+
>>> reverse_count({"01": 10, "10": 20})
|
|
26
|
+
{'10': 10, '01': 20}
|
|
27
|
+
"""
|
|
15
28
|
ncount = {}
|
|
16
29
|
for k, v in count.items():
|
|
17
30
|
ncount[k[::-1]] = v
|
|
@@ -19,15 +32,56 @@ def reverse_count(count: ct) -> ct:
|
|
|
19
32
|
|
|
20
33
|
|
|
21
34
|
def sort_count(count: ct) -> ct:
|
|
35
|
+
"""
|
|
36
|
+
Sort the count dictionary by counts in descending order.
|
|
37
|
+
|
|
38
|
+
:param count: A dictionary mapping bit strings to counts
|
|
39
|
+
:type count: ct
|
|
40
|
+
:return: A new dictionary sorted by count values (descending)
|
|
41
|
+
:rtype: ct
|
|
42
|
+
|
|
43
|
+
:Example:
|
|
44
|
+
|
|
45
|
+
>>> sort_count({"00": 5, "01": 15, "10": 10})
|
|
46
|
+
{'01': 15, '10': 10, '00': 5}
|
|
47
|
+
"""
|
|
22
48
|
return {k: v for k, v in sorted(count.items(), key=lambda item: -item[1])}
|
|
23
49
|
|
|
24
50
|
|
|
25
51
|
def normalized_count(count: ct) -> Dict[str, float]:
|
|
52
|
+
"""
|
|
53
|
+
Normalize the count dictionary to represent probabilities.
|
|
54
|
+
|
|
55
|
+
:param count: A dictionary mapping bit strings to counts
|
|
56
|
+
:type count: ct
|
|
57
|
+
:return: A new dictionary with probabilities instead of counts
|
|
58
|
+
:rtype: Dict[str, float]
|
|
59
|
+
|
|
60
|
+
:Example:
|
|
61
|
+
|
|
62
|
+
>>> normalized_count({"00": 5, "01": 15})
|
|
63
|
+
{'00': 0.25, '01': 0.75}
|
|
64
|
+
"""
|
|
26
65
|
shots = sum([v for k, v in count.items()])
|
|
27
66
|
return {k: v / shots for k, v in count.items()}
|
|
28
67
|
|
|
29
68
|
|
|
30
69
|
def marginal_count(count: ct, keep_list: Sequence[int]) -> ct:
|
|
70
|
+
"""
|
|
71
|
+
Compute the marginal distribution of a count dictionary over specified qubits.
|
|
72
|
+
|
|
73
|
+
:param count: A dictionary mapping bit strings to counts
|
|
74
|
+
:type count: ct
|
|
75
|
+
:param keep_list: List of qubit indices to keep in the marginal distribution
|
|
76
|
+
:type keep_list: Sequence[int]
|
|
77
|
+
:return: A new count dictionary with marginal distribution
|
|
78
|
+
:rtype: ct
|
|
79
|
+
|
|
80
|
+
:Example:
|
|
81
|
+
|
|
82
|
+
>>> marginal_count({"001": 10, "110": 20}, [0, 2])
|
|
83
|
+
{'01': 10, '10': 20}
|
|
84
|
+
"""
|
|
31
85
|
import qiskit
|
|
32
86
|
|
|
33
87
|
count = reverse_count(count)
|
|
@@ -36,6 +90,21 @@ def marginal_count(count: ct, keep_list: Sequence[int]) -> ct:
|
|
|
36
90
|
|
|
37
91
|
|
|
38
92
|
def count2vec(count: ct, normalization: bool = True) -> Tensor:
|
|
93
|
+
"""
|
|
94
|
+
Convert count dictionary to probability vector.
|
|
95
|
+
|
|
96
|
+
:param count: A dictionary mapping bit strings to counts
|
|
97
|
+
:type count: ct
|
|
98
|
+
:param normalization: Whether to normalize the counts to probabilities, defaults to True
|
|
99
|
+
:type normalization: bool, optional
|
|
100
|
+
:return: Probability vector as numpy array
|
|
101
|
+
:rtype: Tensor
|
|
102
|
+
|
|
103
|
+
:Example:
|
|
104
|
+
|
|
105
|
+
>>> count2vec({"00": 2, "10": 3, "11": 5})
|
|
106
|
+
array([0.2, 0. , 0.3, 0.5])
|
|
107
|
+
"""
|
|
39
108
|
nqubit = len(list(count.keys())[0])
|
|
40
109
|
probability = [0] * 2**nqubit
|
|
41
110
|
shots = sum([v for k, v in count.items()])
|
|
@@ -47,6 +116,21 @@ def count2vec(count: ct, normalization: bool = True) -> Tensor:
|
|
|
47
116
|
|
|
48
117
|
|
|
49
118
|
def vec2count(vec: Tensor, prune: bool = False) -> ct:
|
|
119
|
+
"""
|
|
120
|
+
Convert probability vector to count dictionary.
|
|
121
|
+
|
|
122
|
+
:param vec: Probability vector
|
|
123
|
+
:type vec: Tensor
|
|
124
|
+
:param prune: Whether to remove near-zero probabilities, defaults to False
|
|
125
|
+
:type prune: bool, optional
|
|
126
|
+
:return: Count dictionary
|
|
127
|
+
:rtype: ct
|
|
128
|
+
|
|
129
|
+
:Example:
|
|
130
|
+
|
|
131
|
+
>>> vec2count(np.array([0.2, 0.3, 0.1, 0.4]))
|
|
132
|
+
{'00': 0.2, '01': 0.3, '10': 0.1, '11': 0.4}
|
|
133
|
+
"""
|
|
50
134
|
from ..quantum import count_vector2dict
|
|
51
135
|
|
|
52
136
|
if isinstance(vec, list):
|
|
@@ -63,6 +147,16 @@ def vec2count(vec: Tensor, prune: bool = False) -> ct:
|
|
|
63
147
|
|
|
64
148
|
|
|
65
149
|
def kl_divergence(c1: ct, c2: ct) -> float:
|
|
150
|
+
"""
|
|
151
|
+
Compute the Kullback-Leibler divergence between two count distributions.
|
|
152
|
+
|
|
153
|
+
:param c1: First count dictionary
|
|
154
|
+
:type c1: ct
|
|
155
|
+
:param c2: Second count dictionary
|
|
156
|
+
:type c2: ct
|
|
157
|
+
:return: KL divergence value
|
|
158
|
+
:rtype: float
|
|
159
|
+
"""
|
|
66
160
|
eps = 1e-4 # typical value for inverse of the total shots
|
|
67
161
|
c1 = normalized_count(c1) # type: ignore
|
|
68
162
|
c2 = normalized_count(c2) # type: ignore
|
|
@@ -113,6 +207,11 @@ def merge_count(*counts: ct) -> ct:
|
|
|
113
207
|
:type counts: ct
|
|
114
208
|
:return: Merged count dictionary
|
|
115
209
|
:rtype: ct
|
|
210
|
+
|
|
211
|
+
:Example:
|
|
212
|
+
|
|
213
|
+
>>> merge_count({"00": 10, "01": 20}, {"00": 5, "10": 15})
|
|
214
|
+
{'00': 15, '01': 20, '10': 15}
|
|
116
215
|
"""
|
|
117
216
|
merged: ct = {}
|
|
118
217
|
for count in counts:
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from typing import Any, List, Tuple, Union
|
|
2
|
+
import numpy as np
|
|
3
|
+
from ..cons import dtypestr, backend
|
|
4
|
+
from ..quantum import PauliStringSum2COO
|
|
5
|
+
from .lattice import AbstractLattice
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _create_empty_sparse_matrix(shape: Tuple[int, int]) -> Any:
|
|
9
|
+
"""
|
|
10
|
+
Helper function to create a backend-agnostic empty sparse matrix.
|
|
11
|
+
"""
|
|
12
|
+
indices = backend.convert_to_tensor(backend.zeros((0, 2), dtype="int32"))
|
|
13
|
+
values = backend.convert_to_tensor(backend.zeros((0,), dtype=dtypestr)) # type: ignore
|
|
14
|
+
return backend.coo_sparse_matrix(indices=indices, values=values, shape=shape) # type: ignore
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def heisenberg_hamiltonian(
|
|
18
|
+
lattice: AbstractLattice,
|
|
19
|
+
j_coupling: Union[float, List[float], Tuple[float, ...]] = 1.0,
|
|
20
|
+
) -> Any:
|
|
21
|
+
"""
|
|
22
|
+
Generates the sparse matrix of the Heisenberg Hamiltonian for a given lattice.
|
|
23
|
+
|
|
24
|
+
The Heisenberg Hamiltonian is defined as:
|
|
25
|
+
H = J * Σ_{<i,j>} (X_i X_j + Y_i Y_j + Z_i Z_j)
|
|
26
|
+
where the sum is over all unique nearest-neighbor pairs <i,j>.
|
|
27
|
+
|
|
28
|
+
:param lattice: An instance of a class derived from AbstractLattice,
|
|
29
|
+
which provides the geometric information of the system.
|
|
30
|
+
:type lattice: AbstractLattice
|
|
31
|
+
:param j_coupling: The coupling constants. Can be a single float for an
|
|
32
|
+
isotropic model (Jx=Jy=Jz) or a list/tuple of 3 floats for an
|
|
33
|
+
anisotropic model (Jx, Jy, Jz). Defaults to 1.0.
|
|
34
|
+
:type j_coupling: Union[float, List[float], Tuple[float, ...]], optional
|
|
35
|
+
:return: The Hamiltonian as a backend-agnostic sparse matrix.
|
|
36
|
+
:rtype: Any
|
|
37
|
+
"""
|
|
38
|
+
num_sites = lattice.num_sites
|
|
39
|
+
neighbor_pairs = lattice.get_neighbor_pairs(k=1, unique=True)
|
|
40
|
+
|
|
41
|
+
if isinstance(j_coupling, (float, int)):
|
|
42
|
+
js = [float(j_coupling)] * 3
|
|
43
|
+
else:
|
|
44
|
+
if len(j_coupling) != 3:
|
|
45
|
+
raise ValueError("j_coupling must be a float or a list/tuple of 3 floats.")
|
|
46
|
+
js = [float(j) for j in j_coupling]
|
|
47
|
+
|
|
48
|
+
if not neighbor_pairs:
|
|
49
|
+
return _create_empty_sparse_matrix(shape=(2**num_sites, 2**num_sites))
|
|
50
|
+
if num_sites == 0:
|
|
51
|
+
raise ValueError("Cannot generate a Hamiltonian for a lattice with zero sites.")
|
|
52
|
+
|
|
53
|
+
pauli_map = {"X": 1, "Y": 2, "Z": 3}
|
|
54
|
+
|
|
55
|
+
ls: List[List[int]] = []
|
|
56
|
+
weights: List[float] = []
|
|
57
|
+
|
|
58
|
+
pauli_terms = ["X", "Y", "Z"]
|
|
59
|
+
for i, j in neighbor_pairs:
|
|
60
|
+
for idx, pauli_char in enumerate(pauli_terms):
|
|
61
|
+
if abs(js[idx]) > 1e-9:
|
|
62
|
+
string = [0] * num_sites
|
|
63
|
+
string[i] = pauli_map[pauli_char]
|
|
64
|
+
string[j] = pauli_map[pauli_char]
|
|
65
|
+
ls.append(string)
|
|
66
|
+
weights.append(js[idx])
|
|
67
|
+
|
|
68
|
+
hamiltonian_matrix = PauliStringSum2COO(ls, weight=weights, numpy=False)
|
|
69
|
+
|
|
70
|
+
return hamiltonian_matrix
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def rydberg_hamiltonian(
|
|
74
|
+
lattice: AbstractLattice, omega: float, delta: float, c6: float
|
|
75
|
+
) -> Any:
|
|
76
|
+
"""
|
|
77
|
+
Generates the sparse matrix of the Rydberg atom array Hamiltonian.
|
|
78
|
+
|
|
79
|
+
The Hamiltonian is defined as:
|
|
80
|
+
H = Σ_i (Ω/2)X_i - Σ_i δ(1 - Z_i)/2 + Σ_{i<j} V_ij (1-Z_i)/2 (1-Z_j)/2
|
|
81
|
+
= Σ_i (Ω/2)X_i + Σ_i (δ/2)Z_i + Σ_{i<j} (V_ij/4)(Z_iZ_j - Z_i - Z_j)
|
|
82
|
+
where V_ij = C6 / |r_i - r_j|^6.
|
|
83
|
+
|
|
84
|
+
Note: Constant energy offset terms (proportional to the identity operator)
|
|
85
|
+
are ignored in this implementation.
|
|
86
|
+
|
|
87
|
+
:param lattice: An instance of a class derived from AbstractLattice,
|
|
88
|
+
which provides site coordinates and the distance matrix.
|
|
89
|
+
:type lattice: AbstractLattice
|
|
90
|
+
:param omega: The Rabi frequency (Ω) of the driving laser field.
|
|
91
|
+
:type omega: float
|
|
92
|
+
:param delta: The laser detuning (δ).
|
|
93
|
+
:type delta: float
|
|
94
|
+
:param c6: The Van der Waals interaction coefficient (C6).
|
|
95
|
+
:type c6: float
|
|
96
|
+
:return: The Hamiltonian as a backend-agnostic sparse matrix.
|
|
97
|
+
:rtype: Any
|
|
98
|
+
"""
|
|
99
|
+
num_sites = lattice.num_sites
|
|
100
|
+
if num_sites == 0:
|
|
101
|
+
raise ValueError("Cannot generate a Hamiltonian for a lattice with zero sites.")
|
|
102
|
+
|
|
103
|
+
pauli_map = {"X": 1, "Y": 2, "Z": 3}
|
|
104
|
+
ls: List[List[int]] = []
|
|
105
|
+
weights: List[float] = []
|
|
106
|
+
|
|
107
|
+
for i in range(num_sites):
|
|
108
|
+
x_string = [0] * num_sites
|
|
109
|
+
x_string[i] = pauli_map["X"]
|
|
110
|
+
ls.append(x_string)
|
|
111
|
+
weights.append(omega / 2.0)
|
|
112
|
+
|
|
113
|
+
z_coefficients = np.zeros(num_sites)
|
|
114
|
+
|
|
115
|
+
for i in range(num_sites):
|
|
116
|
+
z_coefficients[i] += delta / 2.0
|
|
117
|
+
|
|
118
|
+
dist_matrix = lattice.distance_matrix
|
|
119
|
+
|
|
120
|
+
for i in range(num_sites):
|
|
121
|
+
for j in range(i + 1, num_sites):
|
|
122
|
+
distance = dist_matrix[i, j]
|
|
123
|
+
|
|
124
|
+
if distance < 1e-9:
|
|
125
|
+
continue
|
|
126
|
+
|
|
127
|
+
interaction_strength = c6 / (distance**6)
|
|
128
|
+
coefficient = interaction_strength / 4.0
|
|
129
|
+
|
|
130
|
+
zz_string = [0] * num_sites
|
|
131
|
+
zz_string[i] = pauli_map["Z"]
|
|
132
|
+
zz_string[j] = pauli_map["Z"]
|
|
133
|
+
ls.append(zz_string)
|
|
134
|
+
weights.append(coefficient)
|
|
135
|
+
|
|
136
|
+
# The interaction term V_ij * n_i * n_j, when expanded using
|
|
137
|
+
# n_i = (1-Z_i)/2, becomes (V_ij/4)*(I - Z_i - Z_j + Z_i*Z_j).
|
|
138
|
+
# This contributes a positive term (+V_ij/4) to the ZZ interaction,
|
|
139
|
+
# but negative terms (-V_ij/4) to the single-site Z_i and Z_j operators.
|
|
140
|
+
|
|
141
|
+
z_coefficients[i] -= coefficient
|
|
142
|
+
z_coefficients[j] -= coefficient
|
|
143
|
+
|
|
144
|
+
for i in range(num_sites):
|
|
145
|
+
if abs(z_coefficients[i]) > 1e-9:
|
|
146
|
+
z_string = [0] * num_sites
|
|
147
|
+
z_string[i] = pauli_map["Z"]
|
|
148
|
+
ls.append(z_string)
|
|
149
|
+
weights.append(z_coefficients[i]) # type: ignore
|
|
150
|
+
|
|
151
|
+
hamiltonian_matrix = PauliStringSum2COO(ls, weight=weights, numpy=False)
|
|
152
|
+
|
|
153
|
+
return hamiltonian_matrix
|
|
@@ -11,6 +11,13 @@ import time
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def gpu_memory_share(flag: bool = True) -> None:
|
|
14
|
+
"""
|
|
15
|
+
Set the GPU memory growth mode
|
|
16
|
+
|
|
17
|
+
:param flag: whether to set the GPU memory growth mode, defaults to True
|
|
18
|
+
:type flag: bool
|
|
19
|
+
:return: None
|
|
20
|
+
"""
|
|
14
21
|
# TODO(@refraction-ray): the default torch behavior should be True
|
|
15
22
|
# preallocate behavior for torch to be investigated
|
|
16
23
|
if flag is True:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorcircuit-nightly
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0.dev20250727
|
|
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)
|
|
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).
|
|
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
|
|
|
@@ -105,6 +105,7 @@ tensorcircuit/templates/chems.py
|
|
|
105
105
|
tensorcircuit/templates/conversions.py
|
|
106
106
|
tensorcircuit/templates/dataset.py
|
|
107
107
|
tensorcircuit/templates/graphs.py
|
|
108
|
+
tensorcircuit/templates/hamiltonians.py
|
|
108
109
|
tensorcircuit/templates/lattice.py
|
|
109
110
|
tensorcircuit/templates/measurements.py
|
|
110
111
|
tensorcircuit_nightly.egg-info/PKG-INFO
|
|
@@ -124,6 +125,7 @@ tests/test_dmcircuit.py
|
|
|
124
125
|
tests/test_ensemble.py
|
|
125
126
|
tests/test_fgs.py
|
|
126
127
|
tests/test_gates.py
|
|
128
|
+
tests/test_hamiltonians.py
|
|
127
129
|
tests/test_interfaces.py
|
|
128
130
|
tests/test_keras.py
|
|
129
131
|
tests/test_lattice.py
|
|
@@ -170,6 +170,14 @@ def test_post_select(backend, highp):
|
|
|
170
170
|
np.testing.assert_allclose(c.get_cmatrix(), c1.get_cmatrix(), atol=1e-5)
|
|
171
171
|
|
|
172
172
|
|
|
173
|
+
@pytest.mark.parametrize("backend", [lf("npb"), lf("tfb"), lf("jaxb")])
|
|
174
|
+
def test_post_select_cmatrix_refresh(backend, highp):
|
|
175
|
+
sim_post = tc.FGSSimulator(L=2, filled=[0])
|
|
176
|
+
sim_post.evol_hp(0, 1, np.pi / 4)
|
|
177
|
+
sim_post.post_select(0, keep=1)
|
|
178
|
+
np.testing.assert_allclose(1 - sim_post.get_cmatrix()[0, 0], 1, atol=1e-6)
|
|
179
|
+
|
|
180
|
+
|
|
173
181
|
@pytest.mark.parametrize("backend", [lf("tfb"), lf("jaxb")])
|
|
174
182
|
def test_jittable_measure(backend):
|
|
175
183
|
@tc.backend.jit
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
import numpy as np
|
|
3
|
+
from pytest_lazyfixture import lazy_fixture as lf
|
|
4
|
+
|
|
5
|
+
import tensorcircuit as tc
|
|
6
|
+
|
|
7
|
+
from tensorcircuit.templates.lattice import (
|
|
8
|
+
ChainLattice,
|
|
9
|
+
SquareLattice,
|
|
10
|
+
CustomizeLattice,
|
|
11
|
+
)
|
|
12
|
+
from tensorcircuit.templates.hamiltonians import (
|
|
13
|
+
heisenberg_hamiltonian,
|
|
14
|
+
rydberg_hamiltonian,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
PAULI_X = np.array([[0, 1], [1, 0]], dtype=complex)
|
|
18
|
+
PAULI_Y = np.array([[0, -1j], [1j, 0]], dtype=complex)
|
|
19
|
+
PAULI_Z = np.array([[1, 0], [0, -1]], dtype=complex)
|
|
20
|
+
PAULI_I = np.eye(2, dtype=complex)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestHeisenbergHamiltonian:
|
|
24
|
+
"""
|
|
25
|
+
Test suite for the heisenberg_hamiltonian function.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def test_empty_lattice(self):
|
|
29
|
+
"""
|
|
30
|
+
Test that an empty lattice produces a 0x0 matrix.
|
|
31
|
+
"""
|
|
32
|
+
empty_lattice = CustomizeLattice(
|
|
33
|
+
dimensionality=2, identifiers=[], coordinates=[]
|
|
34
|
+
)
|
|
35
|
+
h = heisenberg_hamiltonian(empty_lattice)
|
|
36
|
+
assert h.shape == (1, 1)
|
|
37
|
+
assert h.nnz == 0
|
|
38
|
+
|
|
39
|
+
def test_single_site(self):
|
|
40
|
+
"""
|
|
41
|
+
Test that a single-site lattice (no bonds) produces a 2x2 zero matrix.
|
|
42
|
+
"""
|
|
43
|
+
single_site_lattice = ChainLattice(size=(1,), pbc=False)
|
|
44
|
+
h = heisenberg_hamiltonian(single_site_lattice)
|
|
45
|
+
assert h.shape == (2, 2)
|
|
46
|
+
assert h.nnz == 0
|
|
47
|
+
|
|
48
|
+
@pytest.mark.parametrize("backend", [lf("npb"), lf("tfb"), lf("jaxb")])
|
|
49
|
+
def test_two_sites_chain(self, backend):
|
|
50
|
+
"""
|
|
51
|
+
Test a two-site chain against a manually calculated Hamiltonian.
|
|
52
|
+
This is the most critical test for scientific correctness.
|
|
53
|
+
"""
|
|
54
|
+
lattice = ChainLattice(size=(2,), pbc=False)
|
|
55
|
+
j_coupling = -1.5 # Test with a non-trivial coupling constant
|
|
56
|
+
h_generated = heisenberg_hamiltonian(lattice, j_coupling=j_coupling)
|
|
57
|
+
|
|
58
|
+
# Manually construct the expected Hamiltonian: H = J * (X_0X_1 + Y_0Y_1 + Z_0Z_1)
|
|
59
|
+
xx = np.kron(PAULI_X, PAULI_X)
|
|
60
|
+
yy = np.kron(PAULI_Y, PAULI_Y)
|
|
61
|
+
zz = np.kron(PAULI_Z, PAULI_Z)
|
|
62
|
+
h_expected = j_coupling * (xx + yy + zz)
|
|
63
|
+
|
|
64
|
+
assert h_generated.shape == (4, 4)
|
|
65
|
+
print(tc.backend.to_dense(h_generated))
|
|
66
|
+
assert np.allclose(tc.backend.to_dense(h_generated), h_expected, atol=1e-5)
|
|
67
|
+
|
|
68
|
+
def test_square_lattice_properties(self):
|
|
69
|
+
"""
|
|
70
|
+
Test properties of a larger lattice (2x2 square) without full matrix comparison.
|
|
71
|
+
"""
|
|
72
|
+
lattice = SquareLattice(size=(2, 2), pbc=True) # 4 sites, 8 bonds with PBC
|
|
73
|
+
h = heisenberg_hamiltonian(lattice, j_coupling=1.0)
|
|
74
|
+
|
|
75
|
+
assert h.shape == (16, 16)
|
|
76
|
+
assert h.nnz > 0
|
|
77
|
+
h_dense = tc.backend.to_dense(h)
|
|
78
|
+
assert np.allclose(h_dense, h_dense.conj().T)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class TestRydbergHamiltonian:
|
|
82
|
+
"""
|
|
83
|
+
Test suite for the rydberg_hamiltonian function.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
def test_single_site_rydberg(self):
|
|
87
|
+
"""
|
|
88
|
+
Test a single atom, which should only have driving and detuning terms.
|
|
89
|
+
"""
|
|
90
|
+
lattice = ChainLattice(size=(1,), pbc=False)
|
|
91
|
+
omega, delta, c6 = 2.0, 0.5, 100.0
|
|
92
|
+
h_generated = rydberg_hamiltonian(lattice, omega, delta, c6)
|
|
93
|
+
|
|
94
|
+
h_expected = (omega / 2.0) * PAULI_X + (delta / 2.0) * PAULI_Z
|
|
95
|
+
|
|
96
|
+
assert h_generated.shape == (2, 2)
|
|
97
|
+
assert np.allclose(tc.backend.to_dense(h_generated), h_expected)
|
|
98
|
+
|
|
99
|
+
def test_two_sites_rydberg(self):
|
|
100
|
+
"""
|
|
101
|
+
Test a two-site chain for Rydberg Hamiltonian, including interaction.
|
|
102
|
+
"""
|
|
103
|
+
lattice = ChainLattice(size=(2,), pbc=False, lattice_constant=1.5)
|
|
104
|
+
omega, delta, c6 = 1.0, -0.5, 10.0
|
|
105
|
+
h_generated = rydberg_hamiltonian(lattice, omega, delta, c6)
|
|
106
|
+
|
|
107
|
+
v_ij = c6 / (1.5**6)
|
|
108
|
+
|
|
109
|
+
h1 = (omega / 2.0) * (np.kron(PAULI_X, PAULI_I) + np.kron(PAULI_I, PAULI_X))
|
|
110
|
+
z0_coeff = delta / 2.0 - v_ij / 4.0
|
|
111
|
+
z1_coeff = delta / 2.0 - v_ij / 4.0
|
|
112
|
+
h2 = z0_coeff * np.kron(PAULI_Z, PAULI_I) + z1_coeff * np.kron(PAULI_I, PAULI_Z)
|
|
113
|
+
h3 = (v_ij / 4.0) * np.kron(PAULI_Z, PAULI_Z)
|
|
114
|
+
|
|
115
|
+
h_expected = h1 + h2 + h3
|
|
116
|
+
|
|
117
|
+
assert h_generated.shape == (4, 4)
|
|
118
|
+
h_generated_dense = tc.backend.to_dense(h_generated)
|
|
119
|
+
|
|
120
|
+
assert np.allclose(h_generated_dense, h_expected)
|
|
121
|
+
|
|
122
|
+
def test_zero_distance_robustness(self):
|
|
123
|
+
"""
|
|
124
|
+
Test that the function does not crash when two atoms have zero distance.
|
|
125
|
+
"""
|
|
126
|
+
lattice = CustomizeLattice(
|
|
127
|
+
dimensionality=2,
|
|
128
|
+
identifiers=[0, 1],
|
|
129
|
+
coordinates=[[0.0, 0.0], [0.0, 0.0]],
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
try:
|
|
133
|
+
h = rydberg_hamiltonian(lattice, omega=1.0, delta=1.0, c6=1.0)
|
|
134
|
+
# The X terms contribute 8 non-zero elements.
|
|
135
|
+
# The Z terms (Z0+Z1) have diagonal elements that cancel out,
|
|
136
|
+
# resulting in only 2 non-zero elements. Total nnz = 8 + 2 = 10.
|
|
137
|
+
assert h.nnz == 10
|
|
138
|
+
except ZeroDivisionError:
|
|
139
|
+
pytest.fail("The function failed to handle zero distance between sites.")
|
|
140
|
+
|
|
141
|
+
@pytest.mark.parametrize("backend", [lf("npb"), lf("tfb"), lf("jaxb")])
|
|
142
|
+
def test_anisotropic_heisenberg(self, backend):
|
|
143
|
+
"""
|
|
144
|
+
Test the anisotropic Heisenberg model with different Jx, Jy, Jz.
|
|
145
|
+
"""
|
|
146
|
+
lattice = ChainLattice(size=(2,), pbc=False)
|
|
147
|
+
j_coupling = [-1.0, 0.5, 2.0] # Jx, Jy, Jz
|
|
148
|
+
h_generated = heisenberg_hamiltonian(lattice, j_coupling=j_coupling)
|
|
149
|
+
|
|
150
|
+
# Manually construct the expected Hamiltonian
|
|
151
|
+
jx, jy, jz = j_coupling
|
|
152
|
+
xx = np.kron(PAULI_X, PAULI_X)
|
|
153
|
+
yy = np.kron(PAULI_Y, PAULI_Y)
|
|
154
|
+
zz = np.kron(PAULI_Z, PAULI_Z)
|
|
155
|
+
h_expected = jx * xx + jy * yy + jz * zz
|
|
156
|
+
|
|
157
|
+
h_generated_dense = tc.backend.to_dense(h_generated)
|
|
158
|
+
assert h_generated_dense.shape == (4, 4)
|
|
159
|
+
assert np.allclose(h_generated_dense, h_expected)
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/HISTORY.md
RENAMED
|
File without changes
|
|
File without changes
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/MANIFEST.in
RENAMED
|
File without changes
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/README_cn.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/setup.cfg
RENAMED
|
File without changes
|
{tensorcircuit_nightly-1.2.1.dev20250726 → tensorcircuit_nightly-1.3.0.dev20250727}/setup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|