11using BlockArrays: AbstractBlockArray, blocklengths
22using BlockSparseArrays: BlockSparseArray
3- using GradedArrays: blocklabels, dual, isdual
4- using GradedArrays. SymmetrySectors: SectorProduct, U1, Z
3+ using GradedArrays: SectorProduct, U1, Z, dual, isdual, sectors
54using ITensorBase: ITensor, Index, gettag, prime, settag
65using NamedDimsArrays: dename
76using QuantumOperatorDefinitions: OpName, SiteType, StateName, op, state
@@ -11,13 +10,13 @@ using Test: @test, @testset
1110 t = SiteType (" S=1/2" ; gradings= (" Sz" ,))
1211 r = AbstractUnitRange (t)
1312 @test r == 1 : 2
14- @test blocklabels (r) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
13+ @test sectors (r) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
1514 @test blocklengths (r) == [1 , 1 ]
1615
1716 t = SiteType (" Electron" ; gradings= (" Nf" , " Sz" ))
1817 r = AbstractUnitRange (t)
1918 @test r == 1 : 4
20- @test blocklabels (r) == [
19+ @test sectors (r) == [
2120 SectorProduct ((; Nf= U1 (0 ), Sz= U1 (0 ))),
2221 SectorProduct ((; Nf= U1 (1 ), Sz= U1 (1 ))),
2322 SectorProduct ((; Nf= U1 (1 ), Sz= U1 (- 1 ))),
@@ -28,7 +27,7 @@ using Test: @test, @testset
2827 t = SiteType (" Electron" ; gradings= (" Nf" => " NfA" , " Sz" => " SzA" ))
2928 r = AbstractUnitRange (t)
3029 @test r == 1 : 4
31- @test blocklabels (r) == [
30+ @test sectors (r) == [
3231 SectorProduct ((; NfA= U1 (0 ), SzA= U1 (0 ))),
3332 SectorProduct ((; NfA= U1 (1 ), SzA= U1 (1 ))),
3433 SectorProduct ((; NfA= U1 (1 ), SzA= U1 (- 1 ))),
@@ -39,7 +38,7 @@ using Test: @test, @testset
3938 t = SiteType (" Electron" ; gradings= (" NfParity" , " Sz" ))
4039 r = AbstractUnitRange (t)
4140 @test r == 1 : 4
42- @test blocklabels (r) == [
41+ @test sectors (r) == [
4342 SectorProduct ((; NfParity= Z {2} (0 ), Sz= U1 (0 ))),
4443 SectorProduct ((; NfParity= Z {2} (1 ), Sz= U1 (1 ))),
4544 SectorProduct ((; NfParity= Z {2} (1 ), Sz= U1 (- 1 ))),
@@ -49,9 +48,9 @@ using Test: @test, @testset
4948
5049 t = SiteType (" S=1/2" ; gradings= (" Sz" ,))
5150 (r1, r2) = axes (OpName (" σ⁺" ), (t,))
52- @test blocklabels (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
51+ @test sectors (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
5352 @test blocklengths (r1) == [1 , 1 ]
54- @test blocklabels (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (- 1 )))]
53+ @test sectors (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
5554 @test blocklengths (r2) == [1 , 1 ]
5655
5756 t = SiteType (" S=1/2" ; gradings= (" Sz" ,))
@@ -64,17 +63,17 @@ using Test: @test, @testset
6463 @test a == [2 , 0 ]
6564 @test a isa BlockSparseArray
6665 (r1,) = axes (a)
67- @test blocklabels (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
66+ @test sectors (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
6867 @test blocklengths (r1) == [1 , 1 ]
6968
7069 t = SiteType (" S=1/2" ; gradings= (" Sz" ,))
7170 a = op (" σ⁺" , t)
7271 @test a == [0 2 ; 0 0 ]
7372 @test a isa BlockSparseArray
7473 (r1, r2) = axes (a)
75- @test blocklabels (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
74+ @test sectors (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
7675 @test blocklengths (r1) == [1 , 1 ]
77- @test blocklabels (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (- 1 )))]
76+ @test sectors (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
7877 @test blocklengths (r2) == [1 , 1 ]
7978end
8079
8382 @test gettag (i, " sitetype" ) == " S=1/2"
8483 # TODO : Test without denaming.
8584 @test dename (i) == 1 : 2
86- @test blocklabels (dename (i)) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
85+ @test sectors (dename (i)) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
8786 @test blocklengths (dename (i)) == [1 , 1 ]
8887
8988 i′ = prime (i)
9493 @test a′ isa BlockSparseArray
9594 # TODO : Test these without denaming `a`.
9695 (r1, r2) = axes (a′)
97- @test blocklabels (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
96+ @test sectors (r1) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
9897 @test blocklengths (r1) == [1 , 1 ]
99- @test blocklabels (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (- 1 )))]
98+ @test sectors (r2) == [SectorProduct ((; Sz= U1 (0 ))), SectorProduct ((; Sz= U1 (1 )))]
10099 @test blocklengths (r2) == [1 , 1 ]
101100end
0 commit comments