Skip to content
Permalink
Browse files

Implement sparse superoperator - sparse multiplication

  • Loading branch information
david-pl committed Jul 3, 2018
1 parent 0f037a4 commit b95c8a5cbc47706cdde97f5fe599185d80e4e1a9
Showing with 8 additions and 0 deletions.
  1. +5 −0 src/superoperators.jl
  2. +3 −0 test/test_superoperators.jl
@@ -104,6 +104,11 @@ function *(a::SuperOperator, b::DenseOperator)
data = a.data*reshape(b.data, length(b.data))
return DenseOperator(a.basis_l[1], a.basis_l[2], reshape(data, length(a.basis_l[1]), length(a.basis_l[2])))
end
function *(a::SuperOperator, b::SparseOperator)
check_multiplicable(a, b)
data = a.data*reshape(b.data, length(b.data))
return SparseOperator(a.basis_l[1], a.basis_l[2], reshape(data, length(a.basis_l[1]), length(a.basis_l[2])))
end

function *(a::SuperOperator, b::SuperOperator)
check_multiplicable(a, b)
@@ -156,6 +156,9 @@ op2 = DenseOperator(spinbasis, [0.2+0.1im 0.1+2.3im; 0.8+4.0im 0.3+1.4im])
@test spre(sparse(op1))*op2 == op1*op2
@test spost(sparse(op1))*op2 == op2*op1

@test spre(sparse(op1))*sparse(op2) == sparse(op1*op2)
@test spost(sparse(op1))*sparse(op2) == sparse(op2*op1)

L = liouvillian(H, J)
ρ = -1im*(H*ρ₀ - ρ₀*H)
for j=J

0 comments on commit b95c8a5

Please sign in to comment.
You can’t perform that action at this time.