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: docs/source/advance.rst
+145Lines changed: 145 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,151 @@ We support two modes of analog simulation, where :py:meth:`tensorcircuit.experim
149
149
v, gs = hybrid_evol(b)
150
150
151
151
152
+
Time Evolution
153
+
------------------
154
+
155
+
TensorCircuit-NG provides several methods for simulating quantum time evolution, including exact diagonalization, Krylov subspace methods, and ODE-based approaches.
156
+
These methods are essential for studying quantum dynamics, particularly in many-body systems, and all support automatic differentiation (AD) and JIT compilation for enhanced performance.
157
+
158
+
**Exact Diagonalization:**
159
+
160
+
For small systems where full diagonalization is feasible, the :py:meth:`tensorcircuit.timeevol.ed_evol` method provides exact time evolution by directly computing matrix exponentials:
161
+
162
+
.. code-block:: python
163
+
164
+
import tensorcircuit as tc
165
+
166
+
# Create Heisenberg Hamiltonian for a 4-site chain
167
+
n =4
168
+
g = tc.templates.graphs.Line1D(n, pbc=False)
169
+
h = tc.quantum.heisenberg_hamiltonian(g, hzz=1.0, hxx=1.0, hyy=1.0, sparse=False)
170
+
171
+
# Initial Neel state: |↑↓↑↓⟩
172
+
c = tc.Circuit(n)
173
+
c.x([1, 3]) # Apply X gates to qubits 1 and 3
174
+
psi0 = c.state()
175
+
176
+
# Imaginary time evolution times
177
+
times = tc.backend.convert_to_tensor([0.0, 0.5, 1.0, 2.0])
1. **Exact diagonalization Evolution**: Best for small systems where exact results are required. Most efficient for time-independent Hamiltonians.
270
+
271
+
2. **Krylov Evolution**: Ideal for large systems with time-independent Hamiltonians. Provides a good balance between accuracy and computational efficiency. The subspace dimension controls the trade-off between accuracy and speed.
272
+
273
+
3. **ODE Local Evolution**: Suitable for time-dependent Hamiltonians acting on a few qubits. Most flexible for complex control protocols or digital-analog hybrid programs.
274
+
275
+
4. **ODE Global Evolution**: Best for time-dependent Hamiltonians acting on the entire system.
276
+
277
+
**Advanced Usage:**
278
+
279
+
Callback functions can be used to compute observables during evolution without storing all state vectors:
280
+
281
+
.. code-block:: python
282
+
283
+
defcompute_total_magnetization(state):
284
+
# Compute total magnetization ⟨∑Zᵢ⟩
285
+
n =int(tc.backend.log2(tc.backend.shape_tuple(state)[0]))
286
+
circuit = tc.Circuit(n, inputs=state)
287
+
total_mz =sum(circuit.expectation_ps(z=[i]) for i inrange(n))
All time evolution methods in TensorCircuit support automatic differentiation and JIT compilation, making them suitable for variational optimization and other machine learning applications in quantum physics.
0 commit comments