qojulia / QuantumOpticsBase.jl

Base functionality library for QuantumOptics.jl
Other
64 stars 34 forks source link

Missing `tensor()` method for SuperOperator type #138

Open ba2tro opened 1 year ago

ba2tro commented 1 year ago

Hi! I was trying to compute a tensor product for two superoperators but it looks like we don't have dispatch for tensor() that applies to ::SparseSuperOpType

using QuantumOpticsBase
sOp1 = spre(create(FockBasis(1)))
sOp2 = spost(create(FockBasis(1)))
julia> sOp1⊗sOp2
ERROR: MethodError: no method matching tensor(::SparseSuperOpType{Tuple{FockBasis{Int64}, FockBasis{Int64}}, Tuple{FockBasis{Int64}, FockBasis{Int64}}, SparseArrays.SparseMatrixCSC{ComplexF64, Int64}}, ::SparseSuperOpType{Tuple{FockBasis{Int64}, FockBasis{Int64}}, Tuple{FockBasis{Int64}, FockBasis{Int64}}, SparseArrays.SparseMatrixCSC{ComplexF64, Int64}})
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1
akirakyle commented 1 year ago

To implement this, I think it might be good to use the Choi representation which I have a draft PR for in #115 since its just a normal kron of the Choi operators (possibly with a permutesystems). Unless you're planning on working on this, I can try to implement it when I get around to moving #115 out of draft status.

ba2tro commented 1 year ago

I'm not sure if we would need it immediately, so please feel free to work on it in #115, as it seems to be in line with the other stuff in that pr

akirakyle commented 1 week ago

I've implemented tensor in #177 so once that's merged, this can be closed