# QuTiP development notebook for testing liouvillian construction¶

Copyright (C) 2011 and later, Paul D. Nation & Robert J. Johansson

In [1]:
%pylab inline

In [2]:
from qutip import *
import time

In [3]:
def system_ops2(N):
N1 = N
N2 = N + 1
a1 = tensor(rand_dm(N1, density=0.75), identity(N2))
a2 = tensor(identity(N1), rand_dm(N2, density=0.75))
H = a1.dag() * a1 + a2.dag() * a2
c_ops = [sqrt(0.01) * a1, sqrt(0.025) * a2]

return H, c_ops

In [4]:
def system_ops(N):
N1 = N
N2 = N + 1
N3 = N + 2
a1 = tensor(rand_dm(N1, density=0.75), identity(N2), identity(N3))
a2 = tensor(identity(N1), rand_dm(N2, density=0.75), identity(N3))
a3 = tensor(identity(N1), identity(N2), rand_dm(N3, density=0.75))
H = a1.dag() * a1 + a2.dag() * a2 + a3.dag() * a3
c_ops = [sqrt(0.01) * a1, sqrt(0.025) * a2, sqrt(0.05) * a3]

return H, c_ops

In [5]:
H, c_ops = system_ops(3)

In [6]:
L1 = liouvillian(H, c_ops)

In [7]:
L1

Out[7]:
$$\text{Quantum object: dims = [[[3, 4, 5], [3, 4, 5]], [[3, 4, 5], [3, 4, 5]]], shape = [3600, 3600], type = oper, isHerm = False}\\[1em]\begin{pmatrix}-0.00256494099689 & (-0.00307415314864-0.076080799489j) & (0.033366093512-0.0528309427102j) & (-0.0183708833457-0.0205756760023j) & (-0.00298280679784-0.0383390031161j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.00254464103746-0.0758148452381j) & (-0.00284982536638-0.00392547434544j) & (0.00306075496276-0.0682200814748j) & (-0.021925618026-0.0498224321009j) & (0.00816725018561-0.0359836649834j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(-0.0335618884238-0.0535207987983j) & (-0.00308318703801-0.0675039760736j) & (-0.00293737657568+0.0620860250016j) & (-0.0145142057428-0.0247217855076j) & (-0.0043980322777-0.0191890586456j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.0174252222192-0.0206108256213j) & (0.0229221808928-0.0498631170457j) & (0.0148379106412-0.0243359017603j) & (-0.00371603521964+0.0987181802235j) & (0.013748778866-0.0125933410448j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.00318001184024-0.0381833481246j) & (-0.00834056050947-0.0360124453046j) & (0.00407535300662-0.0192301831298j) & (-0.0134902859676-0.0131358387474j) & (-0.00300305511706+0.1002020077j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (-0.00283214206424-0.1002020077j) & (-0.00406593321521-0.0759574524111j) & (0.0326185894166-0.0535481147571j) & (-0.0183963772296-0.0203147465414j) & (-0.00362325817036-0.0382450034502j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.00155286097089-0.075938192316j) & (-0.00300367311903-0.104127482046j) & (0.00203777869023-0.0680493642967j) & (-0.0229844163148-0.049494504321j) & (0.00767358994043-0.0361176499589j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (-0.0343093925193-0.0528036267514j) & (-0.00410616331054-0.0676746932517j) & (-0.00203637880258-0.0381159826987j) & (-0.0149846653195-0.0243819678752j) & (-0.00459160097588-0.0191372492238j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.0173997283353-0.0208717550822j) & (0.021863382604-0.0501910448256j) & (0.0143674510645-0.0246757193927j) & (-0.00178652069194-0.00148382747683j) & (0.0134751119728-0.0129646575603j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.00253956046772-0.0382773477904j) & (-0.00883422075465-0.0358784603291j) & (0.00388178430845-0.0192819925516j) & (-0.0137639528608-0.0127645222319j) & -0.00148379365523\\\end{pmatrix}$$
In [8]:
L2 = liouvillian_fast(H, c_ops)

In [9]:
L2

Out[9]:
$$\text{Quantum object: dims = [[[3, 4, 5], [3, 4, 5]], [[3, 4, 5], [3, 4, 5]]], shape = [3600, 3600], type = oper, isHerm = True}\\[1em]\begin{pmatrix}-0.00256494099689 & (-0.00307415314864-0.076080799489j) & (0.033366093512-0.0528309427102j) & (-0.0183708833457-0.0205756760023j) & (-0.00298280679784-0.0383390031161j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.00254464103746-0.0758148452381j) & (-0.00284982536638-0.00392547434544j) & (0.00306075496276-0.0682200814748j) & (-0.021925618026-0.0498224321009j) & (0.00816725018561-0.0359836649834j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(-0.0335618884238-0.0535207987983j) & (-0.00308318703801-0.0675039760736j) & (-0.00293737657568+0.0620860250016j) & (-0.0145142057428-0.0247217855076j) & (-0.0043980322777-0.0191890586456j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.0174252222192-0.0206108256213j) & (0.0229221808928-0.0498631170457j) & (0.0148379106412-0.0243359017603j) & (-0.00371603521964+0.0987181802235j) & (0.013748778866-0.0125933410448j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\(0.00318001184024-0.0381833481246j) & (-0.00834056050947-0.0360124453046j) & (0.00407535300662-0.0192301831298j) & (-0.0134902859676-0.0131358387474j) & (-0.00300305511706+0.1002020077j) & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (-0.00283214206424-0.1002020077j) & (-0.00406593321521-0.0759574524111j) & (0.0326185894166-0.0535481147571j) & (-0.0183963772296-0.0203147465414j) & (-0.00362325817036-0.0382450034502j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.00155286097089-0.075938192316j) & (-0.00300367311903-0.104127482046j) & (0.00203777869023-0.0680493642967j) & (-0.0229844163148-0.049494504321j) & (0.00767358994043-0.0361176499589j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (-0.0343093925193-0.0528036267514j) & (-0.00410616331054-0.0676746932517j) & (-0.00203637880258-0.0381159826987j) & (-0.0149846653195-0.0243819678752j) & (-0.00459160097588-0.0191372492238j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.0173997283353-0.0208717550822j) & (0.021863382604-0.0501910448256j) & (0.0143674510645-0.0246757193927j) & (-0.00178652069194-0.00148382747683j) & (0.0134751119728-0.0129646575603j)\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & (0.00253956046772-0.0382773477904j) & (-0.00883422075465-0.0358784603291j) & (0.00388178430845-0.0192819925516j) & (-0.0137639528608-0.0127645222319j) & -0.00148379365523\\\end{pmatrix}$$
In [10]:
timeit liouvillian(H, c_ops)

1 loops, best of 3: 496 ms per loop

In [11]:
timeit liouvillian_fast(H, c_ops)

10 loops, best of 3: 41.5 ms per loop


### Full inspection of small system¶

In [12]:
N1 = 2
N2 = 2

a1 = tensor(rand_dm(N1, density=1.0), identity(N2))
a2 = tensor(identity(N1), rand_dm(N2, density=1.0))

H = a1.dag() * a1 + a2.dag() * a2

c_ops = [sqrt(1.0) * a1, sqrt(2.0) * a2]

In [13]:
N1 = 2

a1 = rand_dm(N1, density=1.0)

H = a1.dag() * a1

c_ops = [sqrt(1.0) * a1]

In [14]:
L1 = liouvillian(H, c_ops)

L1

Out[14]:
$$\text{Quantum object: dims = [[[2], [2]], [[2], [2]]], shape = [4, 4], type = oper, isHerm = False}\\[1em]\begin{pmatrix}-0.144765690223 & (0.344985612913-0.161228510818j) & (0.344985612913+0.161228510818j) & 0.144765690223\\(-0.357041058975-0.132406147982j) & (-0.148136870154-0.0821118740651j) & (-0.101655033798-0.103069681134j) & (0.357041058975+0.132406147982j)\\(-0.357041058975+0.132406147982j) & (-0.101655033798+0.103069681134j) & (-0.148136870154+0.0821118740651j) & (0.357041058975-0.132406147982j)\\0.144765690223 & (-0.344985612913+0.161228510818j) & (-0.344985612913-0.161228510818j) & -0.144765690223\\\end{pmatrix}$$
In [15]:
L2 = liouvillian_fast(H, c_ops)

L2

Out[15]:
$$\text{Quantum object: dims = [[[2], [2]], [[2], [2]]], shape = [4, 4], type = oper, isHerm = True}\\[1em]\begin{pmatrix}-0.144765690223 & (0.344985612913-0.161228510818j) & (0.344985612913+0.161228510818j) & 0.144765690223\\(-0.357041058975-0.132406147982j) & (-0.148136870154-0.0821118740651j) & (-0.101655033798-0.103069681134j) & (0.357041058975+0.132406147982j)\\(-0.357041058975+0.132406147982j) & (-0.101655033798+0.103069681134j) & (-0.148136870154+0.0821118740651j) & (0.357041058975-0.132406147982j)\\0.144765690223 & (-0.344985612913+0.161228510818j) & (-0.344985612913-0.161228510818j) & -0.144765690223\\\end{pmatrix}$$
In [16]:
L1-L2

Out[16]:
$$\text{Quantum object: dims = [[[2], [2]], [[2], [2]]], shape = [4, 4], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

### Benchmark vs system size¶

In [17]:
def benchmark_liouvillian(N_vec):

res1 = zeros(shape(N_vec))
res2 = zeros(shape(N_vec))

for idx, N in enumerate(N_vec):
H, c_ops = system_ops(N)

t0 = time.time()
L = liouvillian(H, c_ops)
t1 = time.time()
res1[idx] = t1-t0

t0 = time.time()
L = liouvillian_fast(H, c_ops)
t1 = time.time()
res2[idx] = t1-t0

return res1, res2

In [18]:
N_vec = array([2,3,4,5,6,7,8])

In [19]:
t0 = time.time()
res1, res2 = benchmark_liouvillian(N_vec)
t1 = time.time()

t1-t0

Out[19]:
651.1269519329071
In [20]:
fig, axes = subplots(1, 2, figsize=(14, 6))

axes[0].plot(N_vec, res1, lw=2, label='liouvillian')
axes[0].plot(N_vec, res2, lw=2, label='liouvillian_fast')
axes[0].legend(loc=0)

axes[1].plot(N_vec, res1 / res2, lw=2, label='speedup')
axes[1].legend(loc=0)

Out[20]:
<matplotlib.legend.Legend at 0x48718d0>

### Test different combinations of preconstructed liouvillians¶

In [21]:
H, c_ops = system_ops2(3)


#### Standard¶

In [22]:
liouvillian(H, c_ops) - liouvillian_fast(H, c_ops)

Out[22]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

#### Without collapse operators¶

In [23]:
liouvillian(H, []) - liouvillian_fast(H, [])

Out[23]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

#### Without hamiltonian¶

In [24]:
liouvillian(None, c_ops) - liouvillian_fast(None, c_ops)

Out[24]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = super, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

#### With preconstructed liouvillian instead of collapse operators¶

In [25]:
L_c_ops = liouvillian(None, c_ops)

In [26]:
liouvillian(H, [L_c_ops]) - liouvillian_fast(H, [L_c_ops])

Out[26]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$
In [27]:
liouvillian(None, [L_c_ops]) - liouvillian_fast(None, [L_c_ops])

Out[27]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = super, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

#### With preconstructed liouvillian instead of hamiltonian¶

In [28]:
L_H = liouvillian_fast(H, [])

In [29]:
liouvillian(H, []) - liouvillian_fast(L_H, [])

Out[29]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$
In [30]:
liouvillian(H, c_ops) - liouvillian_fast(L_H, c_ops)

Out[30]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$
In [31]:
liouvillian(H, c_ops) - liouvillian_fast(L_H, [L_c_ops])

Out[31]:
$$\text{Quantum object: dims = [[[3, 4], [3, 4]], [[3, 4], [3, 4]]], shape = [144, 144], type = oper, isHerm = False}\\[1em]\begin{pmatrix}0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\vdots & \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots & \vdots\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\0.0 & 0.0 & 0.0 & 0.0 & 0.0 & \cdots & 0.0 & 0.0 & 0.0 & 0.0 & 0.0\\\end{pmatrix}$$

### Software versions¶

In [32]:
from qutip.ipynbtools import version_table; version_table()

Out[32]:
SoftwareVersion
Cython0.16
SciPy0.10.1
QuTiP2.3.0.dev-25303b6
Python2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2]
IPython0.13
OSposix [linux2]
Numpy1.7.0.dev-3f45eaa
matplotlib1.3.x
Tue Mar 5 15:26:54 2013