Generic Super-Operators
When a system's evolution doesn't fit the built-in Schrödinger or Lindblad forms,
assemble the equation of motion yourself from SuperOperator terms that act on the
density matrix from the left, the right, or both sides.
What a super-operator is
A super-operator is a linear map that takes the density matrix ρ and returns dρ/dt. Any master
equation can be written as a sum of three primitive actions — left multiplication
L·ρ, right multiplication ρ·R, and sandwiched multiplication L·ρ·R.
qalgora.SuperOperator lets you add those terms directly, lifting the restriction to
the Hamiltonian-plus-collapse-operator template.
Rebuilding the von Neumann equation
The closed-system law dρ/dt = −i[H, ρ] is just two terms:
import qalgora
from qalgora import operators, Schedule
import numpy as np
H = 2.0 * np.pi * 0.1 * operators.spin.z(0)
psi0 = np.array([1.0, 0.0], dtype=complex)
rho0 = np.outer(psi0, psi0.conj()) # a density matrix
sop = qalgora.SuperOperator()
sop += qalgora.SuperOperator.left_multiply(-1j * H) # -i H rho
sop += qalgora.SuperOperator.right_multiply(1j * H) # +i rho H
result = qalgora.evolve(
sop, dimensions={0: 2},
schedule=Schedule(steps=np.linspace(0, 1, 100), parameters=["t"]),
initial_state=qalgora.State.from_data(rho0), # a density matrix
observables=[operators.spin.z(0)],
)
Adding a custom dissipator
The sandwiched term L·ρ·L† is exactly what a Lindblad jump operator needs.
Here is amplitude damping written by hand — equivalent to passing a collapse operator, but every
term is under your control. These terms continue the sop built in the
von Neumann example above; start a fresh sop = qalgora.SuperOperator() if you want the
dissipator alone.
gamma = 0.05
L = operators.boson.annihilate(0) # lowering / loss operator
Ldag = operators.boson.create(0)
LdagL = Ldag * L # operator product (use @ if these are dense matrices)
sop += gamma * qalgora.SuperOperator.left_right_multiply(L, Ldag) # gamma L rho L^dag
sop += qalgora.SuperOperator.left_multiply(-0.5 * gamma * LdagL) # -gamma/2 (L^dag L) rho
sop += qalgora.SuperOperator.right_multiply(-0.5 * gamma * LdagL) # -gamma/2 rho (L^dag L)
When to reach for it
| Situation | Use |
|---|---|
| Closed system | pass a Hamiltonian to evolve |
| Standard dissipation | add collapse_operators |
| Non-Lindblad / custom master equation | SuperOperator (this page) |
scalar(callable) coefficient. With the documented
parameters=["t"] convention the callable receives the single time argument
t, so super-operator terms switch on and off over the
schedule exactly like Hamiltonian terms.
通用超算符
当系统演化既套不进内置的薛定谔形式,也套不进 Lindblad 形式时,就用 SuperOperator 项自己搭运动方程——这些项可以从左、从右,或者两侧同时作用到密度矩阵上。
什么是超算符
超算符是把密度矩阵 ρ 映射到 dρ/dt 的线性映射。任何主方程都能拆成三种基本作用之和:左乘 L·ρ、右乘 ρ·R,以及夹乘 L·ρ·R。qalgora.SuperOperator 让你把这些项直接加起来,不再被"哈密顿量加坍缩算符"那套模板框死。
重建冯诺依曼方程
封闭系统的演化定律 dρ/dt = −i[H, ρ],写出来不过两项:
import qalgora
from qalgora import operators, Schedule
import numpy as np
H = 2.0 * np.pi * 0.1 * operators.spin.z(0)
psi0 = np.array([1.0, 0.0], dtype=complex)
rho0 = np.outer(psi0, psi0.conj()) # 一个密度矩阵
sop = qalgora.SuperOperator()
sop += qalgora.SuperOperator.left_multiply(-1j * H) # -i H rho
sop += qalgora.SuperOperator.right_multiply(1j * H) # +i rho H
result = qalgora.evolve(
sop, dimensions={0: 2},
schedule=Schedule(steps=np.linspace(0, 1, 100), parameters=["t"]),
initial_state=qalgora.State.from_data(rho0), # 一个密度矩阵
observables=[operators.spin.z(0)],
)
添加自定义耗散项
夹乘项 L·ρ·L† 正是 Lindblad 跳跃算符要用的。下面手写一个幅度阻尼,效果跟传一个坍缩算符一样,但每一项都攥在你自己手里。这些项沿用上面冯诺依曼示例中的 sop;若只想要耗散项,请重新 sop = qalgora.SuperOperator()。
gamma = 0.05
L = operators.boson.annihilate(0) # 下降 / 损耗算符
Ldag = operators.boson.create(0)
LdagL = Ldag * L # 算符乘积 若为稠密矩阵请用 @
sop += gamma * qalgora.SuperOperator.left_right_multiply(L, Ldag) # gamma L rho L^dag
sop += qalgora.SuperOperator.left_multiply(-0.5 * gamma * LdagL) # -gamma/2 (L^dag L) rho
sop += qalgora.SuperOperator.right_multiply(-0.5 * gamma * LdagL) # -gamma/2 rho (L^dag L)
何时使用
| 场景 | 用法 |
|---|---|
| 封闭系统 | 向 evolve 传一个哈密顿量 |
| 标准耗散 | 加 collapse_operators |
| 非 Lindblad / 自定义主方程 | SuperOperator(本页) |
scalar(callable) 系数。按照文档中 parameters=["t"] 的约定,该可调用对象接收单个时间参数 t,所以超算符项跟哈密顿量项一样,可以沿着调度随时开合。