Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tensorcircuit/tensorcircuit-ng
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.1
Choose a base ref
...
head repository: tensorcircuit/tensorcircuit-ng
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 3 commits
  • 8 files changed
  • 1 contributor

Commits on May 9, 2025

  1. enable workflow

    refraction-ray committed May 9, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    refraction-ray Shixin Zhang
    Copy the full SHA
    b22c918 View commit details
  2. update readme

    refraction-ray committed May 9, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    refraction-ray Shixin Zhang
    Copy the full SHA
    87486c5 View commit details

Commits on Jun 5, 2025

  1. update readme

    refraction-ray committed Jun 5, 2025

    Verified

    This commit was signed with the committer’s verified signature.
    refraction-ray Shixin Zhang
    Copy the full SHA
    e8d06ac View commit details
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ jobs:
name: test
strategy:
matrix:
os: [ubuntu-20.04] # macos-latest disabled as one test randomly fails
os: [ubuntu-22.04] # macos-latest disabled as one test randomly fails
python-version: ["3.10"]
fail-fast: false
steps:
2 changes: 1 addition & 1 deletion .github/workflows/nightly_release.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ on:
- cron: "0 12 * * *"
jobs:
tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: test
strategy:
fail-fast: false
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -25,19 +25,19 @@

<p align="center"> English | <a href="README_cn.md"> 简体中文 </a></p>

TensorCircuit-NG is an open-source high-performance quantum software framework, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, and vectorized parallelism, 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.
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, and vectorized parallelism, 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.

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 and analog cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.

TensorCircuit-NG is [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) with TensorCircuit with more new features and bug fixes (support latest `numpy>2` and `qiskit>1`).
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 and distributed simulation) and bug fixes (support latest `numpy>2` and `qiskit>1`).

## Getting Started

Please begin with [Quick Start](/docs/source/quickstart.rst) in the [full documentation](https://tensorcircuit-ng.readthedocs.io/).

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.

For beginners, please refer to [quantum computing lectures with TC-NG](https://github.com/sxzgroup/qc_lecture) to learn both quantum computing basis and representative usage of TensorCircuit-NG.
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.

The following are some minimal demos.

@@ -157,7 +157,7 @@ We also have [Docker support](/docker).

- JIT, AD, vectorized parallelism compatible

- GPU support, quantum device access support, hybrid deployment support
- GPU support, QPU access support, hybrid deployment support

- HPC native, distributed simulation enabled, multiple devices/hosts support

@@ -322,6 +322,8 @@ TensorCircuit-NG is open source, released under the Apache License, Version 2.0.

## Research and Applications

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.

### DQAS

For the application of Differentiable Quantum Architecture Search, see [applications](/tensorcircuit/applications).
@@ -370,12 +372,18 @@ For the setup and simulation code of neural network encoded variational quantum

Reference paper: https://arxiv.org/abs/2308.01068 (published in PRApplied).

### Effective temperature in approximate ansatzes
### Effective temperature in ansatzes

For the simulation implementation of quantum states based on neural networks, tensor networs and quantum circuits using TensorCircuit-NG, see the [project repo](https://github.com/sxzgroup/et).

Reference paper: https://arxiv.org/abs/2411.18921.

### A Unified Variational Framework for Quantum Excited States

For the simulation code and data for variational optimization of simutaneous excited states, see the [project repo](https://github.com/sxzgroup/quantum_excited_state).

Reference paper: https://arxiv.org/abs/2504.21459.

### More works

<details>
@@ -419,7 +427,7 @@ Reference paper: https://arxiv.org/abs/2411.18921.

- Non-Markovianity benefits quantum dynamics simulation: https://arxiv.org/abs/2311.17622.

- Variational post-selection for ground states and thermal states simulation: https://arxiv.org/abs/2402.07605 (published in PRB).
- Variational post-selection for ground states and thermal states simulation: https://arxiv.org/abs/2402.07605 (published in QST).

- Subsystem information capacity in random circuits and Hamiltonian dynamics: https://arxiv.org/abs/2405.05076.

6 changes: 4 additions & 2 deletions tensorcircuit/basecircuit.py
Original file line number Diff line number Diff line change
@@ -796,8 +796,10 @@ def readouterror_bs(
"""
# if isinstance(readout_error, tuple):
# readout_error = list[readout_error] # type: ignore

nqubit = len(readout_error) # type: ignore
try:
nqubit = int(readout_error.shape[0]) # type: ignore
except AttributeError:
nqubit = len(readout_error) # type: ignore
readoutlist = []
for i in range(nqubit):
readoutlist.append(
5 changes: 4 additions & 1 deletion tensorcircuit/results/readout_mitigation.py
Original file line number Diff line number Diff line change
@@ -723,7 +723,10 @@ def _matvec_solver( # type: ignore
cals = self._form_cals(qubits)
M = M3MatVec(dict(counts), cals, distance)
L = spla.LinearOperator(
(M.num_elems, M.num_elems), matvec=M.matvec, rmatvec=M.rmatvec
(M.num_elems, M.num_elems),
matvec=M.matvec,
rmatvec=M.rmatvec,
dtype=np.float64,
)
diags = M.get_diagonal()

1 change: 0 additions & 1 deletion tensorcircuit/translation.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,6 @@


def get_qiskit_qasm(qc: Any) -> str:

try:
qasm_str = qc.qasm() # type: ignore
except AttributeError: # qiskit 1.0
5 changes: 0 additions & 5 deletions tests/test_interfaces.py
Original file line number Diff line number Diff line change
@@ -431,7 +431,6 @@ def g(a, b, c):


def test_jax_interface_basic(tfb):

def f(params):
c = tc.Circuit(1)
c.rx(0, theta=params[0])
@@ -453,7 +452,6 @@ def f(params):


def test_jax_interface_multiple_inputs(tfb):

def f(params1, params2):
c = tc.Circuit(2)
c.rx(0, theta=params1[0])
@@ -481,7 +479,6 @@ def f(params1, params2):
reason="might fail when testing with other function",
)
def test_jax_interface_jit_dlpack(tfb):

def f(params):
c = tc.Circuit(2)
c.rx(range(2), theta=params)
@@ -502,7 +499,6 @@ def f(params):


def test_jax_interface_pure_callback(tfb):

def f(params):
# Use TF operation to test pure_callback
return tf.square(params)
@@ -531,7 +527,6 @@ def f_jax2(params):


def test_jax_interface_multiple_outputs(tfb):

def f(params):
# Use TF operation to test pure_callback
return tf.square(params), params
1 change: 0 additions & 1 deletion tests/test_results.py
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ def test_marginal_count():


def test_merge_count():

c1 = {"00": 10, "01": 20, "11": 30}
c2 = {"00": 5, "10": 15, "11": 25}
c3 = {"01": 10, "10": 20}