Skip to content

Commit

Permalink
nsubsystems move (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
ba2tro authored Sep 25, 2023
1 parent 763be70 commit d33a453
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ Makie = "0.19"
NetworkLayout = "0.4.4"
PrecompileTools = "1"
QuantumClifford = "0.8"
QuantumInterface = "0.3.0"
QuantumInterface = "0.3.3"
QuantumOptics = "1.0.5"
QuantumOpticsBase = "0.4.16"
QuantumOpticsBase = "0.4.17"
QuantumSymbolics = "0.2.4"
Reexport = "1.2.2"
ResumableFunctions = "0.6.1"
Expand Down
1 change: 1 addition & 0 deletions src/QuantumSavory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using Graphs

using QuantumInterface: basis, tensor, , apply!, traceout!,
AbstractOperator, AbstractKet, AbstractSuperOperator, Basis, SpinBasis
import QuantumInterface: nsubsystems

export apply!, traceout!, removebackref!
export project_traceout! #TODO should move to QuantumInterface
Expand Down
9 changes: 1 addition & 8 deletions src/backends/quantumoptics/quantumoptics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ import QuantumOpticsBase: GenericBasis, CompositeBasis,
projector, identityoperator, embed, dm, expect, ptrace, spre, spost
import QuantumOptics
import QuantumOptics: timeevolution
import QuantumInterface: nsubsystems

const QOR = QuantumOpticsRepr()

nsubsystems(s::Ket) = nsubsystems(s.basis)
function nsubsystems(s::Operator)
@assert s.basis_l == s.basis_r
nsubsystems(s.basis_l)
end
nsubsystems(b::CompositeBasis) = length(b.bases)
nsubsystems(b::Basis) = 1

subsystemcompose(states::Ket...) = tensor(states...)
subsystemcompose(ops::Operator...) = tensor(ops...)
subsystemcompose(k::Ket, op::Operator) = tensor(dm(k),op) # TODO this should be more general
Expand Down

0 comments on commit d33a453

Please sign in to comment.