BosonStrings
Documentation for BosonStrings.
BosonStrings.Operator
Base.:*
Base.:+
Base.:+
Base.:+
Base.:-
Base.:/
Base.show
BosonStrings.annihilation
BosonStrings.equal
BosonStrings.expect
BosonStrings.inner
BosonStrings.inner
BosonStrings.ione
BosonStrings.op_to_dense
BosonStrings.rk4
BosonStrings.rk4_lindblad
BosonStrings.trim
BosonStrings.Operator
— TypeRepresent an normal ordered boson operator Each key is a
Base.:*
— MethodBase.:*(o1::Operator, o2::Operator)
Multiplication of two operators. Only supports single boson operator for now.
Base.:+
— MethodBase.:+(o::Matrix, term::Tuple{Number, Tuple{Int,Int} })
Add a term to a dense matrix operator. To add a term of the form c*(†n)(m)
, do o+=c,n,m
Base.:+
— MethodBase.:+(o1::Operator, o2::Operator)
Base.:+(o::Operator, a::Number)
Base.:+(a::Number, o::Operator)
Addition between operators and numbers
Base.:+
— MethodBase.:+(o::Operator, term::Tuple{Number, Vararg{Tuple{Int,Int,Int}} })
Add a term to an operator. The term is of the form c, (site1, n1, m1), (site2, n2, m2) ...
where triplets (site, n, m)
represent $a_{site}^{\dagger n} a_{site}^m$. The following example adds the term $a_{1}^{\dagger 1} a_{1}^1 a_{2}^{\dagger 2} a_{2}^3 a_{4}^{\dagger 5} a_{4}^5$ to a 4-bosons operator:
o = Operator(4)
o += 1, (1, 1, 1), (2, 2, 3), (4, 5, 5)
julia> o
(1.0 + 0.0im) (†1)(1)·(†2)(3)·(†0)(0)·(†5)(5)
Base.:-
— MethodBase.:-(o::Operator)
Base.:-(o1::Operator, o2::Operator)
Base.:-(o::Operator, a::Number)
Base.:-(a::Number, o::Operator)
Subtraction between operators and numbers
Base.:/
— MethodBase.:/(o::Operator, a::Number)
Divide an operator by a number
Base.show
— MethodBase.show(io::IO, o::Operator)
Print an operator in a human-readable format. The operator is printed as a sum of terms, each term is a coefficient followed by a string of boson operators.
BosonStrings.annihilation
— Methodannihilation(d::Int)
Create a d x d annihilation operator, dense matrix.
BosonStrings.equal
— Methodequal(o1, o2; tol=1e-10)
Compare two operators. Return true if they are equal within the tolerance tol.
BosonStrings.expect
— Methodexpect(o::Operator, in_state::n, out_state::m)
Return <n|o|m> where |m> and |n> are foch states. TODO : many body
BosonStrings.inner
— Methodinner(n::Int, o::Matrix, m::Int)
Return <n|o|m> where o
is a single boson operator represented as a dense matrix.
BosonStrings.inner
— Methodinner(n::Int, o::Operator, m::Int)
Return <n|o|m> where |n> and |m> are foch states. TODO : many body
BosonStrings.ione
— Methodreturn the index of the 1 string
BosonStrings.op_to_dense
— Methodop_to_dense(o::Operator, dim::Int)
Convert a boson Operator
to a dense matrix of dimention dim
.
BosonStrings.rk4
— Methodrk4(H::Operator, O::Operator, dt::Real; hbar::Real=1, heisenberg=true, M=2^20, keep::Operator=Operator(N))
Single step of Runge–Kutta-4 with time independant Hamiltonian. Returns O(t+dt). Set heisenberg=true
for evolving an observable in the heisenberg picture. If heisenberg=false
then it is assumed that O is a density matrix. M
is the number of strings to keep.
BosonStrings.rk4_lindblad
— Methodrk4_lindblad(H::Operator, O::Operator, dt::Real, L; hbar::Real=1, heisenberg=true, M=2^20, gamma=[])
Single step of Runge–Kutta-4 for solving the Lindblad equation
$\dot{O}=i[H,O]+\sum_i \gamma_i \left(L_i^\dagger O L_i -\frac{1}{2} \{ L_i^\dagger L_i, O\} \right)$
Returns O(t+dt). L
is a list of jump operators. Set heisenberg=true
for evolving an observable in the heisenberg picture. If heisenberg=false
then it is assumed that O is a density matrix.
BosonStrings.trim
— Methodtrim(o::Operator, max_strings::Int)
Keep the first max_strings
terms with largest coeficients.