Skip to content

Commit 1a246a1

Browse files
authored
Add length(::ProductSector) (#23)
1 parent 1180232 commit 1a246a1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/product.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ end
1616
Base.Tuple(a::ProductSector) = a.sectors
1717

1818
Base.getindex(s::ProductSector, i::Int) = getindex(s.sectors, i)
19+
Base.length(s::ProductSector) = length(s.sectors)
1920
Base.iterate(s::ProductSector, args...) = iterate(s.sectors, args...)
2021
Base.indexed_iterate(s::ProductSector, args...) = Base.indexed_iterate(s.sectors, args...)
2122

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ end
6060
@test typeof(a b) == I1 I2
6161
end
6262
@test @constinferred(Tuple(SU2Irrep(1) U1Irrep(0))) == (SU2Irrep(1), U1Irrep(0))
63+
@test @constinferred(length(FermionParity(1) SU2Irrep(1 // 2) U1Irrep(1))) == 3
6364
end
6465

6566
@testset "Issue that came up in #11" begin

0 commit comments

Comments
 (0)