Skip to content

Commit 961b25e

Browse files
committed
Depricate PauliBasis
1 parent 54c92bf commit 961b25e

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
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.10 - 2025-04-06
4+
5+
- Deprecate `PauliBasis` as it is identical to `SpinBasis(1//2)^N` but without the compatibility with `CompositeBasis`.
6+
37
## v0.3.9 - 2025-04-03
48

59
- Deprecate `equal_bases`.

src/bases.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -289,25 +289,6 @@ end
289289
Base.:(==)(b1::NLevelBasis, b2::NLevelBasis) = b1.N == b2.N
290290

291291

292-
"""
293-
PauliBasis(num_qubits::Int)
294-
295-
Basis for an N-qubit space where `num_qubits` specifies the number of qubits.
296-
The dimension of the basis is 2²ᴺ.
297-
"""
298-
struct PauliBasis{S,B} <: Basis
299-
shape::S
300-
bases::B
301-
function PauliBasis(num_qubits::T) where {T<:Integer}
302-
shape = [2 for _ in 1:num_qubits]
303-
bases = Tuple(SpinBasis(1//2) for _ in 1:num_qubits)
304-
return new{typeof(shape),typeof(bases)}(shape, bases)
305-
end
306-
end
307-
308-
Base.:(==)(pb1::PauliBasis, pb2::PauliBasis) = length(pb1.bases) == length(pb2.bases)
309-
310-
311292
"""
312293
SpinBasis(n)
313294

src/deprecated.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,17 @@ function equal_bases(a, b)
1010
end
1111
return true
1212
end
13+
14+
struct PauliBasis{S,B} <: Basis
15+
shape::S
16+
bases::B
17+
function PauliBasis(num_qubits::T) where {T<:Integer}
18+
Base.depwarn("`PauliBasis` will be removed in future versions. See https://github.com/qojulia/QuantumInterface.jl/issues/36", :PauliBasis)
19+
shape = [2 for _ in 1:num_qubits]
20+
bases = Tuple(SpinBasis(1//2) for _ in 1:num_qubits)
21+
return new{typeof(shape),typeof(bases)}(shape, bases)
22+
end
23+
end
24+
25+
Base.:(==)(pb1::PauliBasis, pb2::PauliBasis) = length(pb1.bases) == length(pb2.bases)
26+

0 commit comments

Comments
 (0)