You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,23 @@
5
5
TensorCircuit is a **Tensor Network-first**, **Multi-Backend** quantum computing framework. When contributing to this codebase, you must adhere to the following architectural principles:
6
6
7
7
### Unified Backend Interface
8
+
8
9
-**Rule**: Never use backend-specific libraries (numpy, tensorflow, jax) directly in core logic.
9
10
-**Pattern**: Use the `tc.backend` abstraction for all tensor operations.
10
11
-**Example**: Use `tc.backend.sin(x)` instead of `np.sin(x)` or `tf.math.sin(x)`. This ensures code runs seamlessly on TensorFlow, JAX, PyTorch, and NumPy.
11
12
12
13
### Differentiable Programming (AD)
14
+
13
15
-**Rule**: All core components must be differentiable.
14
16
-**Pattern**: Avoid operations that break the computation graph (e.g., converting to numpy inside a differentiable function, using in-place assignments on tensors).
15
17
-**Goal**: End-to-end differentiability allows variational algorithms and gradient-based optimization to work out of the box.
16
18
17
19
### JIT-First Optimization
20
+
18
21
-**Rule**: Write code that is JIT-compilable (Just-In-Time).
19
22
-**Pattern**: Avoid Python control flow (if/else) that depends on tensor values. Use `tc.backend.cond` or `tc.backend.switch` if necessary, or structure code to be statically analyzable.
20
23
-**Benefit**: This enables massive speedups on JAX and TensorFlow backends.
21
24
22
-
23
25
## Repository Structure
24
26
25
27
-`tensorcircuit/`: Core package source code.
@@ -60,7 +62,6 @@ TensorCircuit is a **Tensor Network-first**, **Multi-Backend** quantum computing
60
62
### Configuration Files
61
63
62
64
1.`requirements/` - Contains various requirement files:
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,15 +44,17 @@ For beginners, please refer to [quantum computing lectures with TC-NG](https://g
44
44
To write TC-NG scripts and applications efficiently with AI coding agents (e.g., Claude Code, Cursor, Antigravity), we strongly recommend **working directly within the local tensorcircuit-ng repository** rather than an empty folder.
45
45
46
46
1.**Rich Context:** The 100+ scripts in `examples/` and extensive test cases in `tests/` provide essential references that significantly reduce AI hallucinations.
47
-
2.**Built-in Rules:** We provide a dedicated **[`llm.md`](/llm.md)** file. It serves as the "handbook" (i.e. `CLAUDE.md`) for AI agents, defining coding standards and best practices to ensure the generated code is idiomatic.
47
+
2.**Built-in Rules:** We provide a dedicated **[`AGENTS.md`](/AGENTS.md)** file. It serves as the "handbook" (i.e. `CLAUDE.md`) for AI agents, defining coding standards and best practices to ensure the generated code is idiomatic.
48
48
49
49
**Recommended Workflow:**
50
50
51
51
1. Clone the repository: `git clone https://github.com/tensorcircuit/tensorcircuit-ng.git`
52
52
2. Switch to a local playground branch: `git checkout -b my-playground` in case messing up with the original repository.
53
53
3. Open the repository folder in your AI IDE. And you are ready to start writing TC-NG scripts.
54
54
55
-
Now, enjoy implementing quantum algorithms entirely through natural language.
55
+
Now, enjoy implementing quantum algorithms entirely through natural language!
56
+
57
+
### Quick Demos
56
58
57
59
The following are some minimal demos.
58
60
@@ -198,9 +200,7 @@ We also have [Docker support](/docker).
198
200
- Support **Fermion Gaussian state** simulation with expectation, entanglement, measurement, ground state, real and imaginary time evolution.
199
201
- Support **qudits simulation** for tensor network and MPS approximation modes.
200
202
- Support **parallel** quantum circuit evaluation across **multiple GPUs**.
201
-
202
203
- Highly customizable **noise model** with gate error and scalable readout error.
203
-
204
204
- Support for **non-unitary** gate and post-selection simulation.
205
205
206
206
- Support **real quantum devices access** from different providers.
0 commit comments