Skip to content

Commit b3be671

Browse files
authored
Deprecate equal_bases (#41)
1 parent 8407cc3 commit b3be671

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# News
22

3-
## v0.3.9 - 2025-04-08
3+
## v0.3.9 - 2025-04-03
44

5+
- Deprecate `equal_bases`.
56
- Add `GabsRepr` type for representations in Gabs.
67

78
## v0.3.8 - 2025-03-08
9+
810
- Introduce `metrics.jl` file for metric declarations.
911

1012
## v0.3.7 - 2025-01-16

src/QuantumInterface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,6 @@ include("express.jl")
103103

104104
include("metrics.jl")
105105

106+
include("deprecated.jl")
107+
106108
end # module

src/bases.jl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ function equal_shape(a, b)
120120
return true
121121
end
122122

123-
"""
124-
equal_bases(a, b)
125-
126-
Check if two subbases vectors are identical.
127-
"""
128-
function equal_bases(a, b)
129-
if a===b
130-
return true
131-
end
132-
for i=1:length(a)
133-
if a[i]!=b[i]
134-
return false
135-
end
136-
end
137-
return true
138-
end
139-
140123
"""
141124
Exception that should be raised for an illegal algebraic operation.
142125
"""

src/deprecated.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function equal_bases(a, b)
2+
Base.depwarn("`==` should be preferred over `equal_bases`!", :equal_bases)
3+
if a===b
4+
return true
5+
end
6+
for i=1:length(a)
7+
if a[i]!=b[i]
8+
return false
9+
end
10+
end
11+
return true
12+
end

test/test_bases.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using Test
2-
using QuantumInterface: tensor, , ptrace, reduced, permutesystems, equal_bases, multiplicable
2+
using QuantumInterface: tensor, , ptrace, reduced, permutesystems, multiplicable
33
using QuantumInterface: GenericBasis, CompositeBasis, NLevelBasis, FockBasis
44

55
@testset "basis" begin
@@ -49,7 +49,7 @@ comp1 = tensor(b1, b2, b3)
4949
comp2 = tensor(b2, b1, b3)
5050
@test permutesystems(comp1, [2,1,3]) == comp2
5151

52-
@test !equal_bases([b1, b2], [b1, b3])
52+
@test [b1, b2] != [b1, b3]
5353
@test !multiplicable(comp1, b1 b2 NLevelBasis(prod(b3.shape)))
5454

5555
end # testset

0 commit comments

Comments
 (0)