Skip to content

Commit 70e84f6

Browse files
committed
Deprecate PauliBasis and equal_bases
1 parent 791017c commit 70e84f6

File tree

3 files changed

+33
-38
lines changed

3 files changed

+33
-38
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.7 - 2024-12-05
4+
5+
- Deprecate `PauliBasis` and `equal_bases`
6+
37
## v0.3.6 - 2024-09-08
48

59
- Add `coherentstate`, `thermalstate`, `displace`, `squeeze`, `wigner`, previously from QuantumOptics.

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.6"
4+
version = "0.3.7"
55

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

src/bases.jl

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,6 @@ function equal_shape(a, b)
9494
return true
9595
end
9696

97-
"""
98-
equal_bases(a, b)
99-
100-
Check if two subbases vectors are identical.
101-
"""
102-
function equal_bases(a, b)
103-
if a===b
104-
return true
105-
end
106-
for i=1:length(a)
107-
if a[i]!=b[i]
108-
return false
109-
end
110-
end
111-
return true
112-
end
113-
11497
const BASES_CHECK = Ref(true)
11598

11699
"""
@@ -274,26 +257,6 @@ end
274257

275258
Base.:(==)(b1::NLevelBasis, b2::NLevelBasis) = b1.N == b2.N
276259

277-
278-
"""
279-
PauliBasis(num_qubits::Int)
280-
281-
Basis for an N-qubit space where `num_qubits` specifies the number of qubits.
282-
The dimension of the basis is 2²ᴺ.
283-
"""
284-
struct PauliBasis{S,B} <: Basis
285-
shape::S
286-
bases::B
287-
function PauliBasis(num_qubits::T) where {T<:Integer}
288-
shape = [2 for _ in 1:num_qubits]
289-
bases = Tuple(SpinBasis(1//2) for _ in 1:num_qubits)
290-
return new{typeof(shape),typeof(bases)}(shape, bases)
291-
end
292-
end
293-
294-
Base.:(==)(pb1::PauliBasis, pb2::PauliBasis) = length(pb1.bases) == length(pb2.bases)
295-
296-
297260
"""
298261
SpinBasis(n)
299262
@@ -362,3 +325,31 @@ function directsum(b1::SumBasis, b2::SumBasis)
362325
bases = [b1.bases...;b2.bases...]
363326
return SumBasis(shape, (bases...,))
364327
end
328+
329+
Base.@deprecate PauliBasis(num_qubits) NotPauliBasis(num_qubits) false
330+
struct NotPauliBasis{S,B} <: Basis
331+
shape::S
332+
bases::B
333+
function NotPauliBasis(num_qubits::T) where {T<:Integer}
334+
Base.depwarn("`PauliBasis` will be removed in next version!", :NotPauliBasis)
335+
shape = [2 for _ in 1:num_qubits]
336+
bases = Tuple(SpinBasis(1//2) for _ in 1:num_qubits)
337+
return new{typeof(shape),typeof(bases)}(shape, bases)
338+
end
339+
end
340+
341+
Base.:(==)(pb1::NotPauliBasis, pb2::NotPauliBasis) = length(pb1.bases) == length(pb2.bases)
342+
343+
Base.@deprecate equal_bases(a, b) _equal_bases(a, b) false
344+
function _equal_bases(a, b)
345+
Base.depwarn("`equal_bases` will be removed in next version!", :_equal_bases)
346+
if a===b
347+
return true
348+
end
349+
for i=1:length(a)
350+
if a[i]!=b[i]
351+
return false
352+
end
353+
end
354+
return true
355+
end

0 commit comments

Comments
 (0)