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
date: 2025-01-13# last update (keep this comment as a reminder)
4
+
date: 2025-01-20# last update (keep this comment as a reminder)
5
5
6
6
engine: julia
7
7
---
8
8
9
-
In this tutorial, we will show how to solve the master equation using the low-rank method. For a detailed explanation of the method, we recommend to read the Ref. [@gravina2024adaptive].
9
+
## Introduction
10
+
In this tutorial we will demonstrate how to solve the master equation without the quadratic overhead associated with the full manipulation of the density matrix. For a detailed explanation of the method, we recommend to read the Ref. [@gravina2024adaptive].
10
11
11
-
As a test, we will consider the dissipative Ising model with a transverse field. The Hamiltonian is given by
12
+
The proposed approach is based on the realization that many quantum systems, particularly those with low entropy, can be effectively represented by a density matrix of significantly lower rank than what the whole Hilbert space would require. This reduction is achieved by focusing on a subset of states that capture the essential structure of the statistical ensemble characterizing the mixed quantum state, thereby reducing computational complexity while maintaining the exactness of the method.
12
13
14
+
### Low-rank master equations
15
+
We consider a decomposition of the density matrix of the form
where $\{|e_\alpha\rangle\,;\,\alpha=1,\ldots,N\}$ is a fixed basis of the Hilbert space, and $z_{\alpha,k}(t)$ are the time-dependent coefficients.
24
+
25
+
The coefficients $B_{i,j}(t)$ are collected in the matrix $B(t)$, and the coefficients $z_{\alpha,k}(t)$ are collected in the matrix $z(t)$.
26
+
27
+
In [@gravina2024adaptive] all coefficients $B_{i,j}(t)$ and $z_{\alpha,k}(t)$ are taken to be variational parameters. The evolution equation for the density matrix is consequently mapped onto a set of differential equations for such parameters via the time-dependent variational principle (TDVP).
28
+
29
+
The TDVP ensures a dynamical adjustment of the variational states, guaranteeing the optimal set of states is selected at all times to best approximate the dissipative evolution. This allows for a significant reduction in computational complexity as the number of states $M(t)$ necessary to accurately capture the dynamics of the system is as small as can be, hopefully much smaller than the full Hilbert space dimension $N$.
22
30
23
-
We start by importing the packages
31
+
## Low-rank dynamics of the transverse field Heisenberg model
32
+
In this example we consider the dynamics of the transverse field Ising model (TFIM) on a 2x3 lattice. We start by importing the packages
24
33
25
34
```{julia}
26
35
using QuantumToolbox
27
36
using CairoMakie
28
37
```
29
38
30
-
Define lattice
39
+
We define the lattice with dimensions `Nx = 2` and `Ny = 3` and use the `Lattice` class to generate the lattice.
where $ \sigma_i^{x,y,z} $ are the Pauli matrices acting on site $ i $ and $ \langle i,j \rangle $ denotes nearest neighbors. The collapse operators are given by
51
+
$$
52
+
c_i = \sqrt{\gamma} \sigma_i^-,
53
+
$$
54
+
where $ \sigma_i^- $ is the lowering operator acting on site $ i$. The many-body operators are constructed using
55
+
56
+
```{julia}
57
+
Jx = 0.9
58
+
Jy = 1.04
59
+
Jz = 1.0
60
+
hx = 0.0
61
+
γ = 1
62
+
63
+
Sx = mapreduce(i->MultiSiteOperator(latt, i => sigmax()), +, 1:latt.N)
64
+
Sy = mapreduce(i->MultiSiteOperator(latt, i => sigmay()), +, 1:latt.N)
65
+
Sz = mapreduce(i->MultiSiteOperator(latt, i => sigmaz()), +, 1:latt.N)
66
+
67
+
SFxx = sum([MultiSiteOperator(latt, i => sigmax()) * MultiSiteOperator(latt, j => sigmax()) for i in 1:latt.N for j in 1:latt.N])
We proceed by constructing the low-rank basis. `N_cut` is the dimension of the Hilbert space of each mode, and `N_modes` is the number of modes (or spins).
77
+
We consider an initial low-rank basis with `M = Nx * Ny + 1` states.
78
+
79
+
We first define the lr-space dimensions
38
80
39
81
```{julia}
40
-
N_cut = 2
41
-
N_modes = latt.N
42
-
N = N_cut^N_modes
43
-
M = latt.N + 1
82
+
N_cut = 2 # Number of states of each mode
83
+
N_modes = latt.N # Number of modes
84
+
N = N_cut^N_modes # Total number of states
85
+
86
+
M = latt.N + 1; # Number of states in the LR basis
44
87
```
45
88
46
-
Define `lr` states. Take as initial state all spins up. All other `N` states are taken as those with minimum Hamming distance to the initial state.
89
+
Since we will take as initial state for our dynamics the pure state with all spins pointing up, the initial low-rank basis must include at least this state.
47
90
48
91
```{julia}
49
92
ϕ = Vector{QuantumObject{KetQuantumObject,Dimensions{M - 1,NTuple{M - 1,Space}},Vector{ComplexF64}}}(undef, M)
50
93
ϕ[1] = kron(fill(basis(2, 1), N_modes)...)
94
+
```
95
+
96
+
The remaining `M-1` states are taken as those with minimal Hamming distance from the latter state, that is those we obtain by flipping the spin of a single site with respect to the completely polarized state.
51
97
98
+
```{julia}
52
99
i = 1
53
100
for j in 1:N_modes
54
101
global i += 1
55
102
i <= M && (ϕ[i] = MultiSiteOperator(latt, j=>sigmap()) * ϕ[1])
56
103
end
104
+
57
105
for k in 1:N_modes-1
58
106
for l in k+1:N_modes
59
107
global i += 1
60
108
i <= M && (ϕ[i] = MultiSiteOperator(latt, k=>sigmap(), l=>sigmap()) * ϕ[1])
At this point the vector of states `ϕ` contains the full representation of our low-rank states. These coefficients comprise matrix `z`.
114
+
115
+
The matrix `B`, on the other hand, contains the populations and coherences with which each of the low-rank states contributes to the density matrix.
116
+
We initialize it so that only the first state is populated, and all other states are unpopulated.
117
+
118
+
We also compute the full density matrix `ρ` from the low-rank representation. Of course this defeats the purpose of the low-rank representation. We use it here for illustrative purposes to show that the low-rank predictions match the exact dynamics.
70
119
71
120
```{julia}
72
121
z = hcat(get_data.(ϕ)...)
@@ -77,38 +126,33 @@ B = B / tr(S * B) # Normalize B
77
126
ρ = QuantumObject(z * B * z', dims = ntuple(i->N_cut, Val(N_modes))); # Full density matrix
78
127
```
79
128
80
-
Define the Hamiltonian and collapse operators
129
+
### Full evolution
130
+
We now compare the results of the low-rank evolution with the full evolution. We first evolve the system using the `mesolve` function
The `lr_mesolve` function allows to conveniently keep track of non-linear functionals of the density matrix during the evolution without ever computing the full density matrix and without the need to store `z` and `B` at each time step.
140
+
To do so we define the functionals of the density matrix that we want to keep track of and that will be evaluated at each time step.
108
141
109
-
## Low Rank Evolution
142
+
We compute the purity
143
+
$$
144
+
P = \mathrm{Tr}(\rho^2),
145
+
$$
146
+
the von Neumann entropy
147
+
$$
148
+
S = -\mathrm{Tr}(\rho \log_2(\rho)),
149
+
$$
150
+
and the trace
151
+
$$
152
+
\mathrm{Tr}(\rho).
153
+
$$
110
154
111
-
Define functions to be evaluated during the low-rank evolution
155
+
To maximize efficiency and minimize memory allocations we make use of preallocated variables stores in the `parameters` constructor of the solver.
A critical aspect of the LR truncation is the possibility to dynamically adjust the dimension of the basis throughout the system's evolution $M=M(t)$. This adaptability is essential for accommodating changes in the system's entropy over time.
189
+
190
+
To adapt the dimension of the low-rank basis, we look at a control parameter $\chi$ that is positively correlated with the entropy of the system and provides a measure of the quality of the low-rank approximation. When $\chi$ exceeds a certain threshold, the dimension of the low-rank basis is increased by one.
191
+
192
+
The options below specify how the dimension of the low-rank basis is adjusted during the evolution.
`err_max` is the maximum error allowed in the time evolution of the density matrix.
199
+
200
+
`p0` is the initial population with which the new state is added to the basis after crossing the threshold.
148
201
202
+
`adj_condition = "variational"` selects one of three possible definitions for the control quantity `chi`. Specifically, the selected option consists in the leakage from the variational manifold and is defined as
203
+
$$
204
+
\chi = \operatorname{Tr}(S^{-1} L).
205
+
$$
206
+
207
+
Finally, `Δt` specifies the checkpointing interval by which the simulation is rewinded upon the basis expansion.
208
+
209
+
Not directly related to the basis expansion, but still important for the stability of the algorithm, are the options `atol_inv` (the tolerance for the inverse of the overlap matrix) and `alg` (the ODE solver).
210
+
211
+
We now launch the evolution using the `lr_mesolve` function
0 commit comments