Skip to content

Commit

Permalink
move nsubsystems to QuantumInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
ba2tro committed Sep 19, 2023
1 parent 4c6296c commit f37f7ec
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/QuantumOpticsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module QuantumOpticsBase
using SparseArrays, LinearAlgebra, LRUCache, Strided, UnsafeArrays, FillArrays
import LinearAlgebra: mul!, rmul!

import QuantumInterface: dagger, directsum, , dm, embed, expect, identityoperator, identitysuperoperator,
import QuantumInterface: dagger, directsum, , dm, embed, nsubsystems, expect, identityoperator, identitysuperoperator,
permutesystems, projector, ptrace, reduced, tensor, , variance, apply!, basis, AbstractSuperOperator

# index helpers
Expand Down
8 changes: 0 additions & 8 deletions src/apply.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
nsubsystems(s::Ket) = nsubsystems(s.basis)
function nsubsystems(s::Operator)
s.basis_l == s.basis_r || throw(ArgumentError("`nsubsystem(::Operator)` is well defined only if the left and right bases are the same"))
nsubsystems(s.basis_l)
end
nsubsystems(b::CompositeBasis) = length(b.bases)
nsubsystems(b::Basis) = 1

function is_apply_shortcircuit(state, indices, operation)
if nsubsystems(state) == 1
basis(state)==basis(operation) || throw(ArgumentError("`apply!` failed due to incompatible bases of the state and the operation attempted to be applied on it"))
Expand Down

0 comments on commit f37f7ec

Please sign in to comment.