Skip to content

Commit 8ca653a

Browse files
authored
Use SymmetrySectors.U1 in tests (#28)
1 parent 0c2c247 commit 8ca653a

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorAlgebra"
22
uuid = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.8"
4+
version = "0.1.9"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

test/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1010
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
1111
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
1212
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
13+
SymmetrySectors = "f8a8ad64-adbc-4fce-92f7-ffe2bb36a86e"
1314
TensorAlgebra = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
1415
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
1516
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -19,5 +20,6 @@ TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
1920
Aqua = "0.8.9"
2021
SafeTestsets = "0.1"
2122
Suppressor = "0.2"
23+
SymmetrySectors = "0.1"
2224
TensorOperations = "5.1.3"
2325
Test = "1.10"
Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
using BlockArrays: Block
22
using TensorAlgebra:
3-
using GradedUnitRanges: GradedUnitRanges, gradedrange, label
3+
using GradedUnitRanges: GradedUnitRanges, gradedrange, dual, isdual, label
4+
using SymmetrySectors: U1
45
using Test: @test, @testset
56

6-
struct U1
7-
dim::Int
8-
end
9-
Base.isless(l1::U1, l2::U1) = isless(l1.dim, l2.dim)
10-
GradedUnitRanges.fuse_labels(l1::U1, l2::U1) = U1(l1.dim + l2.dim)
11-
12-
## TODO: This should need to get implemented, but `dual`
13-
## isn't being used right now in `GradedUnitRanges`.
14-
## GradedUnitRanges.dual(l::U1) = U1(-l.dim)
15-
167
@testset "TensorAlgebraGradedUnitRangesExt" begin
178
a1 = gradedrange([U1(0) => 2, U1(1) => 3])
189
a2 = gradedrange([U1(2) => 3, U1(3) => 4])
@@ -25,4 +16,16 @@ GradedUnitRanges.fuse_labels(l1::U1, l2::U1) = U1(l1.dim + l2.dim)
2516
@test a[Block(2)] == 7:15
2617
@test a[Block(3)] == 16:23
2718
@test a[Block(4)] == 24:35
19+
@test !isdual(a)
20+
21+
a = a1 dual(a2)
22+
@test label(a[Block(1)]) == U1(-2)
23+
@test label(a[Block(2)]) == U1(-1)
24+
@test label(a[Block(3)]) == U1(-3)
25+
@test label(a[Block(4)]) == U1(-2)
26+
@test a[Block(1)] == 1:6
27+
@test a[Block(2)] == 7:15
28+
@test a[Block(3)] == 16:23
29+
@test a[Block(4)] == 24:35
30+
@test !isdual(a)
2831
end

0 commit comments

Comments
 (0)