Skip to content

Commit

Permalink
move nsubsystems to QuantumInterface (#146)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefan Krastanov <[email protected]>
  • Loading branch information
ba2tro and Krastanov authored Sep 22, 2023
1 parent 3a63760 commit 06809f7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "QuantumOpticsBase"
uuid = "4f57444f-1401-5e15-980d-4471b28d5678"
version = "0.4.16"
version = "0.4.17"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand All @@ -24,7 +24,7 @@ FastExpm = "1.1.0"
FastGaussQuadrature = "0.5"
FillArrays = "0.13, 1"
LRUCache = "1"
QuantumInterface = "0.3.0"
QuantumInterface = "0.3.3"
RandomMatrices = "0.5"
Strided = "1, 2"
UnsafeArrays = "1"
Expand Down
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

2 comments on commit 06809f7

@Krastanov
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/92024

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.17 -m "<description of version>" 06809f719144860f29a9cb91b67006d4ddf96dd1
git push origin v0.4.17

Please sign in to comment.