Skip to content

Commit 35e721b

Browse files
authored
Move nsubsystems from QOBase (#19)
1 parent f535bbb commit 35e721b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# News
22

3+
## v0.3.3
4+
5+
- Add `nsubsystems` for computing the number of subsystems in a state.
6+
37
## v0.3.2
48

59
- Cleanup - removing forgotten debug print statements.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "QuantumInterface"
22
uuid = "5717a53b-5d69-4fa3-b976-0bf2f97ca1e5"
33
authors = ["QuantumInterface.jl contributors"]
4-
version = "0.3.2"
4+
version = "0.3.3"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/embed_permute.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ function embed(basis_l::CompositeBasis, basis_r::CompositeBasis,
8484
end
8585

8686
permutesystems(a::AbstractOperator, perm) = arithmetic_unary_error("Permutations of subsystems", a)
87+
88+
nsubsystems(s::AbstractKet) = nsubsystems(basis(s))
89+
nsubsystems(s::AbstractOperator) = nsubsystems(basis(s))
90+
nsubsystems(b::CompositeBasis) = length(b.bases)
91+
nsubsystems(b::Basis) = 1

0 commit comments

Comments
 (0)