tensorcircuit-nightly 1.4.0.dev20250911__tar.gz → 1.4.0.dev20250913__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.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/CHANGELOG.md +4 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/PKG-INFO +8 -6
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/README.md +7 -5
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/README_cn.md +1 -1
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/__init__.py +2 -1
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/abstractcircuit.py +2 -0
- tensorcircuit_nightly-1.4.0.dev20250913/tensorcircuit/analogcircuit.py +388 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/timeevol.py +2 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit_nightly.egg-info/PKG-INFO +8 -6
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit_nightly.egg-info/SOURCES.txt +1 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/HISTORY.md +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/LICENSE +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/MANIFEST.in +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/pyproject.toml +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/setup.cfg +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/setup.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/about.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/ai/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/ai/ensemble.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/dqas.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/finance/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/finance/portfolio.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/graphdata.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/layers.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/optimization.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/physics/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/physics/baseline.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/physics/fss.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/utils.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/vags.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/van.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/applications/vqes.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/asciiart.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/abstract_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/backend_factory.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/cupy_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/jax_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/jax_ops.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/numpy_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/pytorch_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/pytorch_ops.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/tensorflow_backend.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/backends/tf_ops.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/basecircuit.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/channels.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/circuit.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/abstraction.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/apis.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/config.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/local.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/quafu_provider.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/tencent.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/utils.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cloud/wrapper.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/compiler/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/compiler/composed_compiler.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/compiler/qiskit_compiler.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/compiler/simple_compiler.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/cons.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/densitymatrix.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/experimental.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/fgs.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/gates.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/jax.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/numpy.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/scipy.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/tensorflow.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/tensortrans.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/interfaces/torch.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/keras.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/mps_base.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/mpscircuit.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/noisemodel.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/quantum.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/quditcircuit.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/quditgates.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/counts.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/qem/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/qem/benchmark_circuits.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/qem/qem_methods.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/results/readout_mitigation.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/shadows.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/simplify.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/stabilizercircuit.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/__init__.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/ansatz.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/blocks.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/chems.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/conversions.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/dataset.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/graphs.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/hamiltonians.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/lattice.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/templates/measurements.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/torchnn.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/translation.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/utils.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit/vis.py +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit_nightly.egg-info/dependency_links.txt +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit_nightly.egg-info/requires.txt +0 -0
- {tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/tensorcircuit_nightly.egg-info/top_level.txt +0 -0
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorcircuit-nightly
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev20250913
|
|
4
4
|
Summary: High performance unified quantum computing framework for the NISQ era
|
|
5
5
|
Author-email: TensorCircuit Authors <znfesnpbh@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -62,7 +62,7 @@ Dynamic: license-file
|
|
|
62
62
|
|
|
63
63
|
TensorCircuit-NG is the next-generation open-source high-performance quantum software framework, built upon tensornetwork engines, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, vectorized parallelism and distributed training, providing unified infrastructures and interfaces for quantum programming. It can compose quantum circuits, neural networks and tensor networks seamlessly with high simulation efficiency and flexibility.
|
|
64
64
|
|
|
65
|
-
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, approximate, analog and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
65
|
+
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, qudit, approximate, analog, and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
66
66
|
|
|
67
67
|
TensorCircuit-NG is the actively maintained official version and a [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) successor to TensorCircuit with more new features (stabilizer circuit, multi-card distributed simulation, etc.) and bug fixes (support latest `numpy>2` and `qiskit>1`).
|
|
68
68
|
|
|
@@ -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 90+ [example scripts](/examples) and
|
|
73
|
+
For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 90+ [example scripts](/examples) and 40+ [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
|
|
|
@@ -225,7 +225,7 @@ We also have [Docker support](/docker).
|
|
|
225
225
|
|
|
226
226
|
- Support **Fermion Gaussian state** simulation with expectation, entanglement, measurement, ground state, real and imaginary time evolution.
|
|
227
227
|
|
|
228
|
-
- Support **qudits simulation
|
|
228
|
+
- Support **qudits simulation** for tensor network and MPS approximation modes.
|
|
229
229
|
|
|
230
230
|
- Support **parallel** quantum circuit evaluation across **multiple GPUs**.
|
|
231
231
|
|
|
@@ -247,6 +247,8 @@ We also have [Docker support](/docker).
|
|
|
247
247
|
|
|
248
248
|
- **Machine learning interface/layer/model** abstraction in both TensorFlow, PyTorch and Jax for both numerical simulation and real QPU experiments.
|
|
249
249
|
|
|
250
|
+
- Support time evolution simulation with **exact, ODE, Krylov, Trotter, Chebyshev solvers**.
|
|
251
|
+
|
|
250
252
|
- Circuit sampling supports both final state sampling and perfect sampling from tensor networks.
|
|
251
253
|
|
|
252
254
|
- Light cone reduction support for local expectation calculation.
|
|
@@ -281,7 +283,7 @@ If this project helps in your research, please cite our software whitepaper to a
|
|
|
281
283
|
|
|
282
284
|
which is also a good introduction to the software.
|
|
283
285
|
|
|
284
|
-
Research works citing TensorCircuit can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
286
|
+
Research works citing TensorCircuit-NG can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
285
287
|
|
|
286
288
|
### Guidelines
|
|
287
289
|
|
|
@@ -363,7 +365,7 @@ TensorCircuit-NG is open source, released under the Apache License, Version 2.0.
|
|
|
363
365
|
|
|
364
366
|
## Research and Applications
|
|
365
367
|
|
|
366
|
-
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works and open-source projects that utilize TensorCircuit-NG.
|
|
368
|
+
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works (100+ in total) and open-source projects that utilize TensorCircuit-NG.
|
|
367
369
|
|
|
368
370
|
### DQAS
|
|
369
371
|
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/README.md
RENAMED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
TensorCircuit-NG is the next-generation open-source high-performance quantum software framework, built upon tensornetwork engines, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, vectorized parallelism and distributed training, providing unified infrastructures and interfaces for quantum programming. It can compose quantum circuits, neural networks and tensor networks seamlessly with high simulation efficiency and flexibility.
|
|
29
29
|
|
|
30
|
-
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, approximate, analog and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
30
|
+
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, qudit, approximate, analog, and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
31
31
|
|
|
32
32
|
TensorCircuit-NG is the actively maintained official version and a [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) successor to TensorCircuit with more new features (stabilizer circuit, multi-card distributed simulation, etc.) and bug fixes (support latest `numpy>2` and `qiskit>1`).
|
|
33
33
|
|
|
@@ -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 90+ [example scripts](/examples) and
|
|
38
|
+
For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 90+ [example scripts](/examples) and 40+ [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
|
|
|
@@ -190,7 +190,7 @@ We also have [Docker support](/docker).
|
|
|
190
190
|
|
|
191
191
|
- Support **Fermion Gaussian state** simulation with expectation, entanglement, measurement, ground state, real and imaginary time evolution.
|
|
192
192
|
|
|
193
|
-
- Support **qudits simulation
|
|
193
|
+
- Support **qudits simulation** for tensor network and MPS approximation modes.
|
|
194
194
|
|
|
195
195
|
- Support **parallel** quantum circuit evaluation across **multiple GPUs**.
|
|
196
196
|
|
|
@@ -212,6 +212,8 @@ We also have [Docker support](/docker).
|
|
|
212
212
|
|
|
213
213
|
- **Machine learning interface/layer/model** abstraction in both TensorFlow, PyTorch and Jax for both numerical simulation and real QPU experiments.
|
|
214
214
|
|
|
215
|
+
- Support time evolution simulation with **exact, ODE, Krylov, Trotter, Chebyshev solvers**.
|
|
216
|
+
|
|
215
217
|
- Circuit sampling supports both final state sampling and perfect sampling from tensor networks.
|
|
216
218
|
|
|
217
219
|
- Light cone reduction support for local expectation calculation.
|
|
@@ -246,7 +248,7 @@ If this project helps in your research, please cite our software whitepaper to a
|
|
|
246
248
|
|
|
247
249
|
which is also a good introduction to the software.
|
|
248
250
|
|
|
249
|
-
Research works citing TensorCircuit can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
251
|
+
Research works citing TensorCircuit-NG can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
250
252
|
|
|
251
253
|
### Guidelines
|
|
252
254
|
|
|
@@ -328,7 +330,7 @@ TensorCircuit-NG is open source, released under the Apache License, Version 2.0.
|
|
|
328
330
|
|
|
329
331
|
## Research and Applications
|
|
330
332
|
|
|
331
|
-
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works and open-source projects that utilize TensorCircuit-NG.
|
|
333
|
+
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works (100+ in total) and open-source projects that utilize TensorCircuit-NG.
|
|
332
334
|
|
|
333
335
|
### DQAS
|
|
334
336
|
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/README_cn.md
RENAMED
|
@@ -33,7 +33,7 @@ TensorCircuit-NG 是目前积极维护的唯一官方版本,是 TensorCircuit
|
|
|
33
33
|
|
|
34
34
|
请从 [完整文档](https://tensorcircuit-ng.readthedocs.io/) 中的 [快速上手](/docs/source/quickstart.rst) 开始。
|
|
35
35
|
|
|
36
|
-
有关软件用法,算法实现和工程范式演示的更多信息和介绍,请参阅 90+ [示例脚本](/examples) 和
|
|
36
|
+
有关软件用法,算法实现和工程范式演示的更多信息和介绍,请参阅 90+ [示例脚本](/examples) 和 40+ [案例教程](https://tensorcircuit-ng.readthedocs.io/en/latest/#tutorials)。 [测试](/tests) 用例和 API docstring 也提供了丰富的使用信息。
|
|
37
37
|
|
|
38
38
|
TensorCircuit-NG 也支持 AI 原生编程资源:[Devin Deepwiki](https://deepwiki.com/tensorcircuit/tensorcircuit-ng) 和 [Context7 MCP](https://context7.com/tensorcircuit/tensorcircuit-ng).
|
|
39
39
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = "1.4.0.
|
|
1
|
+
__version__ = "1.4.0.dev20250913"
|
|
2
2
|
__author__ = "TensorCircuit Authors"
|
|
3
3
|
__creator__ = "refraction-ray"
|
|
4
4
|
|
|
@@ -27,6 +27,7 @@ from . import quditgates
|
|
|
27
27
|
from . import basecircuit
|
|
28
28
|
from .gates import Gate
|
|
29
29
|
from .quditcircuit import QuditCircuit
|
|
30
|
+
from .analogcircuit import AnalogCircuit
|
|
30
31
|
from .circuit import Circuit, expectation
|
|
31
32
|
from .mpscircuit import MPSCircuit
|
|
32
33
|
from .densitymatrix import DMCircuit as DMCircuit_reference
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Analog-Digital Hybrid Circuit class wrapper
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any, List, Optional, Callable, Dict, Tuple, Union, Sequence
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from functools import partial
|
|
8
|
+
|
|
9
|
+
import numpy as np
|
|
10
|
+
import tensornetwork as tn
|
|
11
|
+
|
|
12
|
+
from .cons import backend, rdtypestr
|
|
13
|
+
from .abstractcircuit import defined_gates
|
|
14
|
+
from .circuit import Circuit
|
|
15
|
+
from .quantum import QuOperator
|
|
16
|
+
from .timeevol import ode_evol_global, ode_evol_local
|
|
17
|
+
from .utils import arg_alias
|
|
18
|
+
|
|
19
|
+
Tensor = Any
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass
|
|
23
|
+
class AnalogBlock:
|
|
24
|
+
"""A data structure to hold information about an analog evolution block."""
|
|
25
|
+
|
|
26
|
+
hamiltonian_func: Callable[[Tensor], Tensor]
|
|
27
|
+
time: float
|
|
28
|
+
index: Optional[List[int]] = None
|
|
29
|
+
solver_options: Optional[Dict[str, Any]] = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AnalogCircuit:
|
|
33
|
+
"""
|
|
34
|
+
A class for hybrid digital-analog quantum simulation with time-dependent Hamiltonians.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(
|
|
38
|
+
self,
|
|
39
|
+
nqubits: int,
|
|
40
|
+
inputs: Optional[Tensor] = None,
|
|
41
|
+
mps_inputs: Optional[QuOperator] = None,
|
|
42
|
+
split: Optional[Dict[str, Any]] = None,
|
|
43
|
+
dim: Optional[int] = None,
|
|
44
|
+
):
|
|
45
|
+
"""
|
|
46
|
+
Initializes the hybrid circuit.
|
|
47
|
+
|
|
48
|
+
:param num_qubits: The number of qubits in the circuit.
|
|
49
|
+
"""
|
|
50
|
+
self.num_qubits, self._nqubits = nqubits, nqubits
|
|
51
|
+
self.dim = 2**self.num_qubits
|
|
52
|
+
self.inputs = inputs
|
|
53
|
+
if inputs is None:
|
|
54
|
+
self.inputs = np.zeros([self.dim])
|
|
55
|
+
self.inputs[0] = 1.0
|
|
56
|
+
self.inputs = backend.convert_to_tensor(self.inputs)
|
|
57
|
+
|
|
58
|
+
# List of digital circuits, starting with one empty circuit.
|
|
59
|
+
self.digital_circuits: List[Circuit] = [
|
|
60
|
+
Circuit(self.num_qubits, self.inputs, mps_inputs, split, dim)
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
# List of analog blocks, each containing the Hamiltonian function, time, and solver options.
|
|
64
|
+
self.analog_blocks: List[AnalogBlock] = []
|
|
65
|
+
self._effective_circuit: Optional[Circuit] = None
|
|
66
|
+
self._solver_options: Dict[str, Any] = {}
|
|
67
|
+
|
|
68
|
+
def set_solver_options(self, **kws: Any) -> None:
|
|
69
|
+
self._solver_options = kws
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def effective_circuit(self) -> Circuit:
|
|
73
|
+
"""Returns the effective circuit after all blocks have been added."""
|
|
74
|
+
if self._effective_circuit is None:
|
|
75
|
+
self.state()
|
|
76
|
+
return self._effective_circuit # type: ignore
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def current_digital_circuit(self) -> Circuit:
|
|
80
|
+
"""Returns the last (currently active) digital circuit."""
|
|
81
|
+
return self.digital_circuits[-1]
|
|
82
|
+
|
|
83
|
+
def add_analog_block(
|
|
84
|
+
self,
|
|
85
|
+
hamiltonian: Callable[[float], Tensor],
|
|
86
|
+
time: Union[float, List[Tensor]],
|
|
87
|
+
index: Optional[List[int]] = None,
|
|
88
|
+
**solver_options: Any,
|
|
89
|
+
) -> "AnalogCircuit":
|
|
90
|
+
"""
|
|
91
|
+
Adds a time-dependent analog evolution block to the circuit.
|
|
92
|
+
|
|
93
|
+
This finalizes the current digital block and prepares a new one for subsequent gates.
|
|
94
|
+
|
|
95
|
+
:param hamiltonian_func: A function H(t) that takes a time `t` (from 0 to `time`)
|
|
96
|
+
and returns the Hamiltonian matrix at that instant.
|
|
97
|
+
:param time: The total evolution time 'T'.
|
|
98
|
+
:param index: The indices of the qubits to apply the analog evolution to. Defaults None for
|
|
99
|
+
global application.
|
|
100
|
+
:param solver_options: Keyword arguments passed directly to `scipy.integrate.solve_ivp`.
|
|
101
|
+
(e.g., method='RK45', rtol=1e-6, atol=1e-8)
|
|
102
|
+
"""
|
|
103
|
+
# Create and store the analog block information
|
|
104
|
+
time = backend.convert_to_tensor(time, dtype=rdtypestr)
|
|
105
|
+
time = backend.reshape(time, [-1])
|
|
106
|
+
if backend.shape_tuple(time)[0] == 1:
|
|
107
|
+
time = backend.stack([0.0, time[0]]) # type: ignore
|
|
108
|
+
elif backend.shape_tuple(time)[0] > 2:
|
|
109
|
+
raise ValueError(
|
|
110
|
+
"Time must be a scalar or a two elements array for the starting and end points."
|
|
111
|
+
)
|
|
112
|
+
combined_solver_options = self._solver_options.copy()
|
|
113
|
+
combined_solver_options.update(solver_options)
|
|
114
|
+
block = AnalogBlock(
|
|
115
|
+
hamiltonian_func=hamiltonian,
|
|
116
|
+
time=time, # type: ignore
|
|
117
|
+
index=index,
|
|
118
|
+
solver_options=combined_solver_options,
|
|
119
|
+
)
|
|
120
|
+
self.analog_blocks.append(block)
|
|
121
|
+
|
|
122
|
+
# After adding an analog block, we start a new digital block.
|
|
123
|
+
self.digital_circuits.append(Circuit(self.num_qubits, inputs=self.inputs))
|
|
124
|
+
self._effective_circuit = None
|
|
125
|
+
return self # Allow for chaining
|
|
126
|
+
|
|
127
|
+
def __getattr__(self, name: str) -> Any:
|
|
128
|
+
"""
|
|
129
|
+
Metaprogramming to forward gate calls to the current digital circuit.
|
|
130
|
+
This enables syntax like `analog_circuit.h(0)`.
|
|
131
|
+
"""
|
|
132
|
+
gate_method = getattr(self.current_digital_circuit, name, None)
|
|
133
|
+
|
|
134
|
+
if gate_method and callable(gate_method) and name.lower() in defined_gates:
|
|
135
|
+
|
|
136
|
+
def wrapper(*args, **kwargs): # type: ignore
|
|
137
|
+
gate_method(*args, **kwargs)
|
|
138
|
+
self._effective_circuit = None
|
|
139
|
+
return self
|
|
140
|
+
|
|
141
|
+
return wrapper
|
|
142
|
+
else:
|
|
143
|
+
raise AttributeError(
|
|
144
|
+
f"'{type(self).__name__}' object or its underlying '{type(self.current_digital_circuit).__name__}' "
|
|
145
|
+
f"object has no attribute '{name}'."
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
def state(self) -> Tensor:
|
|
149
|
+
"""
|
|
150
|
+
Executes the full digital-analog sequence.
|
|
151
|
+
|
|
152
|
+
:return: The final state vector after the full evolution
|
|
153
|
+
:rtype: Tensor
|
|
154
|
+
"""
|
|
155
|
+
psi = self.inputs
|
|
156
|
+
|
|
157
|
+
# Propagate the state through the alternating circuit blocks
|
|
158
|
+
for i, analog_block in enumerate(self.analog_blocks):
|
|
159
|
+
# 1. Apply Digital Block i
|
|
160
|
+
digital_c = self.digital_circuits[i]
|
|
161
|
+
if i > 0:
|
|
162
|
+
digital_c.replace_inputs(psi)
|
|
163
|
+
psi = digital_c.wavefunction()
|
|
164
|
+
|
|
165
|
+
if analog_block.index is None:
|
|
166
|
+
psi = ode_evol_global( # type: ignore
|
|
167
|
+
hamiltonian=analog_block.hamiltonian_func,
|
|
168
|
+
initial_state=psi,
|
|
169
|
+
times=analog_block.time,
|
|
170
|
+
**analog_block.solver_options,
|
|
171
|
+
)
|
|
172
|
+
else:
|
|
173
|
+
psi = ode_evol_local( # type: ignore
|
|
174
|
+
hamiltonian=analog_block.hamiltonian_func,
|
|
175
|
+
initial_state=psi,
|
|
176
|
+
times=analog_block.time,
|
|
177
|
+
index=analog_block.index,
|
|
178
|
+
**analog_block.solver_options,
|
|
179
|
+
)
|
|
180
|
+
psi = psi[-1]
|
|
181
|
+
# TODO(@refraction-ray): support more time evol methods
|
|
182
|
+
|
|
183
|
+
# 3. Apply the final digital circuit
|
|
184
|
+
self.digital_circuits[-1].replace_inputs(psi)
|
|
185
|
+
psi = self.digital_circuits[-1].wavefunction()
|
|
186
|
+
self._effective_circuit = Circuit(self.num_qubits, inputs=psi)
|
|
187
|
+
|
|
188
|
+
return psi
|
|
189
|
+
|
|
190
|
+
wavefunction = state
|
|
191
|
+
|
|
192
|
+
def expectation(
|
|
193
|
+
self,
|
|
194
|
+
*ops: Tuple[tn.Node, List[int]],
|
|
195
|
+
reuse: bool = True,
|
|
196
|
+
enable_lightcone: bool = False,
|
|
197
|
+
nmc: int = 1000,
|
|
198
|
+
**kws: Any,
|
|
199
|
+
) -> Tensor:
|
|
200
|
+
"""
|
|
201
|
+
Compute expectation(s) of local operators.
|
|
202
|
+
|
|
203
|
+
:param ops: Pairs of `(operator_node, [sites])` specifying where each operator acts.
|
|
204
|
+
:type ops: Tuple[tn.Node, List[int]]
|
|
205
|
+
:param reuse: If True, then the wavefunction tensor is cached for further expectation evaluation,
|
|
206
|
+
defaults to be true.
|
|
207
|
+
:type reuse: bool, optional
|
|
208
|
+
:param enable_lightcone: whether enable light cone simplification, defaults to False
|
|
209
|
+
:type enable_lightcone: bool, optional
|
|
210
|
+
:param nmc: repetition time for Monte Carlo sampling for noisfy calculation, defaults to 1000
|
|
211
|
+
:type nmc: int, optional
|
|
212
|
+
:return: Tensor with one element
|
|
213
|
+
:rtype: Tensor
|
|
214
|
+
"""
|
|
215
|
+
return self.effective_circuit.expectation(
|
|
216
|
+
*ops,
|
|
217
|
+
reuse=reuse,
|
|
218
|
+
enable_lightcone=enable_lightcone,
|
|
219
|
+
noise_conf=None,
|
|
220
|
+
nmc=nmc,
|
|
221
|
+
**kws,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def measure_jit(
|
|
225
|
+
self, *index: int, with_prob: bool = False, status: Optional[Tensor] = None
|
|
226
|
+
) -> Tuple[Tensor, Tensor]:
|
|
227
|
+
"""
|
|
228
|
+
Take measurement on the given site indices (computational basis).
|
|
229
|
+
This method is jittable!
|
|
230
|
+
|
|
231
|
+
:param index: Measure on which site (wire) index.
|
|
232
|
+
:type index: int
|
|
233
|
+
:param with_prob: If true, theoretical probability is also returned.
|
|
234
|
+
:type with_prob: bool, optional
|
|
235
|
+
:param status: external randomness, with shape [index], defaults to None
|
|
236
|
+
:type status: Optional[Tensor]
|
|
237
|
+
:return: The sample output and probability (optional) of the quantum line.
|
|
238
|
+
:rtype: Tuple[Tensor, Tensor]
|
|
239
|
+
"""
|
|
240
|
+
return self.effective_circuit.measure_jit(
|
|
241
|
+
*index, with_prob=with_prob, status=status
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
measure = measure_jit
|
|
245
|
+
|
|
246
|
+
def amplitude(self, l: Union[str, Tensor]) -> Tensor:
|
|
247
|
+
r"""
|
|
248
|
+
Return the amplitude for a given bitstring `l`.
|
|
249
|
+
|
|
250
|
+
For state simulators, this computes :math:`\langle l \vert \psi \rangle`.
|
|
251
|
+
|
|
252
|
+
:param l: Bitstring in base-`d` using `0-9A-Z`.
|
|
253
|
+
:type l: Union[str, Tensor]
|
|
254
|
+
:return: Complex amplitude.
|
|
255
|
+
:rtype: Tensor
|
|
256
|
+
"""
|
|
257
|
+
return self.effective_circuit.amplitude(l)
|
|
258
|
+
|
|
259
|
+
def probability(self) -> Tensor:
|
|
260
|
+
"""
|
|
261
|
+
Get the length-`2^n` probability vector over the computational basis.
|
|
262
|
+
|
|
263
|
+
:return: Probability vector of shape `[dim^n]`.
|
|
264
|
+
:rtype: Tensor
|
|
265
|
+
"""
|
|
266
|
+
return self.effective_circuit.probability()
|
|
267
|
+
|
|
268
|
+
def expectation_ps(
|
|
269
|
+
self,
|
|
270
|
+
x: Optional[Sequence[int]] = None,
|
|
271
|
+
y: Optional[Sequence[int]] = None,
|
|
272
|
+
z: Optional[Sequence[int]] = None,
|
|
273
|
+
ps: Optional[Sequence[int]] = None,
|
|
274
|
+
reuse: bool = True,
|
|
275
|
+
noise_conf: Optional[Any] = None,
|
|
276
|
+
nmc: int = 1000,
|
|
277
|
+
status: Optional[Tensor] = None,
|
|
278
|
+
**kws: Any,
|
|
279
|
+
) -> Tensor:
|
|
280
|
+
"""
|
|
281
|
+
Shortcut for Pauli string expectation.
|
|
282
|
+
x, y, z list are for X, Y, Z positions
|
|
283
|
+
|
|
284
|
+
:Example:
|
|
285
|
+
|
|
286
|
+
>>> c = tc.Circuit(2)
|
|
287
|
+
>>> c.X(0)
|
|
288
|
+
>>> c.H(1)
|
|
289
|
+
>>> c.expectation_ps(x=[1], z=[0])
|
|
290
|
+
array(-0.99999994+0.j, dtype=complex64)
|
|
291
|
+
|
|
292
|
+
:param x: sites to apply X gate, defaults to None
|
|
293
|
+
:type x: Optional[Sequence[int]], optional
|
|
294
|
+
:param y: sites to apply Y gate, defaults to None
|
|
295
|
+
:type y: Optional[Sequence[int]], optional
|
|
296
|
+
:param z: sites to apply Z gate, defaults to None
|
|
297
|
+
:type z: Optional[Sequence[int]], optional
|
|
298
|
+
:param ps: or one can apply a ps structures instead of ``x``, ``y``, ``z``,
|
|
299
|
+
e.g. [0, 1, 3, 0, 2, 2] for X_1Z_2Y_4Y_5
|
|
300
|
+
defaults to None, ``ps`` can overwrite ``x``, ``y`` and ``z``
|
|
301
|
+
:type ps: Optional[Sequence[int]], optional
|
|
302
|
+
:param reuse: whether to cache and reuse the wavefunction, defaults to True
|
|
303
|
+
:type reuse: bool, optional
|
|
304
|
+
:param noise_conf: Noise Configuration, defaults to None
|
|
305
|
+
:type noise_conf: Optional[NoiseConf], optional
|
|
306
|
+
:param nmc: repetition time for Monte Carlo sampling for noisfy calculation, defaults to 1000
|
|
307
|
+
:type nmc: int, optional
|
|
308
|
+
:param status: external randomness given by tensor uniformly from [0, 1], defaults to None,
|
|
309
|
+
used for noisfy circuit sampling
|
|
310
|
+
:type status: Optional[Tensor], optional
|
|
311
|
+
:return: Expectation value
|
|
312
|
+
:rtype: Tensor
|
|
313
|
+
"""
|
|
314
|
+
return self.effective_circuit.expectation_ps(
|
|
315
|
+
x=x,
|
|
316
|
+
y=y,
|
|
317
|
+
z=z,
|
|
318
|
+
ps=ps,
|
|
319
|
+
reuse=reuse,
|
|
320
|
+
noise_conf=noise_conf,
|
|
321
|
+
nmc=nmc,
|
|
322
|
+
status=status,
|
|
323
|
+
**kws,
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
@partial(arg_alias, alias_dict={"format": ["format_"]})
|
|
327
|
+
def sample(
|
|
328
|
+
self,
|
|
329
|
+
batch: Optional[int] = None,
|
|
330
|
+
allow_state: bool = False,
|
|
331
|
+
readout_error: Optional[Sequence[Any]] = None,
|
|
332
|
+
format: Optional[str] = None,
|
|
333
|
+
random_generator: Optional[Any] = None,
|
|
334
|
+
status: Optional[Tensor] = None,
|
|
335
|
+
jittable: bool = True,
|
|
336
|
+
) -> Any:
|
|
337
|
+
r"""
|
|
338
|
+
Batched sampling from the circuit or final state.
|
|
339
|
+
|
|
340
|
+
:param batch: Number of samples. If `None`, returns a single draw.
|
|
341
|
+
:type batch: Optional[int]
|
|
342
|
+
:param allow_state: If `True`, sample from the final state (when memory allows). Prefer `True` for speed.
|
|
343
|
+
:type allow_state: bool
|
|
344
|
+
:param readout_error: Optional readout error model.
|
|
345
|
+
:type readout_error: Optional[Sequence[Any]]
|
|
346
|
+
:param format: Output format. See :py:meth:`tensorcircuit.quantum.measurement_results`.
|
|
347
|
+
:type format: Optional[str]
|
|
348
|
+
:param random_generator: random generator, defaults to None
|
|
349
|
+
:type random_generator: Optional[Any], optional
|
|
350
|
+
:param status: external randomness given by tensor uniformly from [0, 1],
|
|
351
|
+
if set, can overwrite random_generator, shape [batch] for `allow_state=True`
|
|
352
|
+
and shape [batch, nqudits] for `allow_state=False` using perfect sampling implementation
|
|
353
|
+
:type status: Optional[Tensor]
|
|
354
|
+
:param jittable: when converting to count, whether keep the full size. if false, may be conflict
|
|
355
|
+
external jit, if true, may fail for large scale system with actual limited count results
|
|
356
|
+
:type jittable: bool, defaults true
|
|
357
|
+
:return: List (if batch) of tuple (binary configuration tensor and corresponding probability)
|
|
358
|
+
if the format is None, and consistent with format when given
|
|
359
|
+
:rtype: Any
|
|
360
|
+
"""
|
|
361
|
+
return self.effective_circuit.sample(
|
|
362
|
+
batch=batch,
|
|
363
|
+
allow_state=allow_state,
|
|
364
|
+
readout_error=readout_error,
|
|
365
|
+
format=format,
|
|
366
|
+
random_generator=random_generator,
|
|
367
|
+
status=status,
|
|
368
|
+
jittable=jittable,
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
def __repr__(self) -> str:
|
|
372
|
+
s = f"AnalogCircuit(n={self.num_qubits}):\n"
|
|
373
|
+
s += "=" * 40 + "\n"
|
|
374
|
+
|
|
375
|
+
num_stages = len(self.analog_blocks) + 1
|
|
376
|
+
|
|
377
|
+
for i in range(num_stages):
|
|
378
|
+
# Print digital part
|
|
379
|
+
s += f"--- Digital Block {i} ---\n"
|
|
380
|
+
|
|
381
|
+
# Print analog part (if it exists)
|
|
382
|
+
if i < len(self.analog_blocks):
|
|
383
|
+
block = self.analog_blocks[i]
|
|
384
|
+
s += f"--- Analog Block {i} (T={block.time}) ---\n"
|
|
385
|
+
s += f" H(t) function: '{block.hamiltonian_func.__name__}'\n"
|
|
386
|
+
|
|
387
|
+
s += "=" * 40
|
|
388
|
+
return s
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tensorcircuit-nightly
|
|
3
|
-
Version: 1.4.0.
|
|
3
|
+
Version: 1.4.0.dev20250913
|
|
4
4
|
Summary: High performance unified quantum computing framework for the NISQ era
|
|
5
5
|
Author-email: TensorCircuit Authors <znfesnpbh@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -62,7 +62,7 @@ Dynamic: license-file
|
|
|
62
62
|
|
|
63
63
|
TensorCircuit-NG is the next-generation open-source high-performance quantum software framework, built upon tensornetwork engines, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, vectorized parallelism and distributed training, providing unified infrastructures and interfaces for quantum programming. It can compose quantum circuits, neural networks and tensor networks seamlessly with high simulation efficiency and flexibility.
|
|
64
64
|
|
|
65
|
-
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, approximate, analog and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
65
|
+
TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, qudit, approximate, analog, and fermionic cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
|
|
66
66
|
|
|
67
67
|
TensorCircuit-NG is the actively maintained official version and a [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) successor to TensorCircuit with more new features (stabilizer circuit, multi-card distributed simulation, etc.) and bug fixes (support latest `numpy>2` and `qiskit>1`).
|
|
68
68
|
|
|
@@ -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 90+ [example scripts](/examples) and
|
|
73
|
+
For more information on software usage, sota algorithm implementation and engineer paradigm demonstration, please refer to 90+ [example scripts](/examples) and 40+ [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
|
|
|
@@ -225,7 +225,7 @@ We also have [Docker support](/docker).
|
|
|
225
225
|
|
|
226
226
|
- Support **Fermion Gaussian state** simulation with expectation, entanglement, measurement, ground state, real and imaginary time evolution.
|
|
227
227
|
|
|
228
|
-
- Support **qudits simulation
|
|
228
|
+
- Support **qudits simulation** for tensor network and MPS approximation modes.
|
|
229
229
|
|
|
230
230
|
- Support **parallel** quantum circuit evaluation across **multiple GPUs**.
|
|
231
231
|
|
|
@@ -247,6 +247,8 @@ We also have [Docker support](/docker).
|
|
|
247
247
|
|
|
248
248
|
- **Machine learning interface/layer/model** abstraction in both TensorFlow, PyTorch and Jax for both numerical simulation and real QPU experiments.
|
|
249
249
|
|
|
250
|
+
- Support time evolution simulation with **exact, ODE, Krylov, Trotter, Chebyshev solvers**.
|
|
251
|
+
|
|
250
252
|
- Circuit sampling supports both final state sampling and perfect sampling from tensor networks.
|
|
251
253
|
|
|
252
254
|
- Light cone reduction support for local expectation calculation.
|
|
@@ -281,7 +283,7 @@ If this project helps in your research, please cite our software whitepaper to a
|
|
|
281
283
|
|
|
282
284
|
which is also a good introduction to the software.
|
|
283
285
|
|
|
284
|
-
Research works citing TensorCircuit can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
286
|
+
Research works citing TensorCircuit-NG can be highlighted in [Research and Applications section](https://github.com/tensorcircuit/tensorcircuit-ng#research-and-applications).
|
|
285
287
|
|
|
286
288
|
### Guidelines
|
|
287
289
|
|
|
@@ -363,7 +365,7 @@ TensorCircuit-NG is open source, released under the Apache License, Version 2.0.
|
|
|
363
365
|
|
|
364
366
|
## Research and Applications
|
|
365
367
|
|
|
366
|
-
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works and open-source projects that utilize TensorCircuit-NG.
|
|
368
|
+
TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works (100+ in total) and open-source projects that utilize TensorCircuit-NG.
|
|
367
369
|
|
|
368
370
|
### DQAS
|
|
369
371
|
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/HISTORY.md
RENAMED
|
File without changes
|
|
File without changes
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/MANIFEST.in
RENAMED
|
File without changes
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/pyproject.toml
RENAMED
|
File without changes
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/setup.cfg
RENAMED
|
File without changes
|
{tensorcircuit_nightly-1.4.0.dev20250911 → tensorcircuit_nightly-1.4.0.dev20250913}/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
|