Skip to content
8 changes: 6 additions & 2 deletions src/timereversed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ dual(c::TimeReversed{I}) where {I <: Sector} = TimeReversed{I}(dual(c.a))
function ⊗(c1::TimeReversed{I}, c2::TimeReversed{I}) where {I <: Sector}
return SectorSet{TimeReversed{I}}(TimeReversed{I}, c1.a ⊗ c2.a)
end
function Base.IteratorSize(::Type{SectorValues{TimeReversed{I}}}) where {I <: Sector}

function Base.IteratorSize(::Type{SectorValues{TimeReversed{I}}}) where {I}
Comment thread
lkdvos marked this conversation as resolved.
return Base.IteratorSize(values(I))
end
function Base.length(::SectorValues{TimeReversed{I}}) where {I <: Sector}
function Base.size(::SectorValues{TimeReversed{I}}) where {I}
return size(values(I))
end
function Base.length(::SectorValues{TimeReversed{I}}) where {I}
return length(values(I))
end
function Base.getindex(::SectorValues{TimeReversed{I}}, i::Int) where {I <: Sector}
Expand Down
14 changes: 4 additions & 10 deletions test/testsuite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,10 @@ function test_sector(I::Type)
end
end

smallset(::Type{I}) where {I <: Sector} = take(values(I), 5)
function smallset(::Type{ProductSector{Tuple{I1, I2}}}) where {I1, I2}
iter = product(smallset(I1), smallset(I2))
s = collect(i ⊠ j for (i, j) in iter if dim(i) * dim(j) <= 6)
return length(s) > 6 ? rand(s, 6) : s
end
function smallset(::Type{ProductSector{Tuple{I1, I2, I3}}}) where {I1, I2, I3}
iter = product(smallset(I1), smallset(I2), smallset(I3))
s = collect(i ⊠ j ⊠ k for (i, j, k) in iter if dim(i) * dim(j) * dim(k) <= 6)
return length(s) > 6 ? rand(s, 6) : s
function smallset(::Type{I}, size::Int = 5, maxdim::Real = 10) where {I <: Sector}
sectors = collect(Iterators.take(values(I), 10 * size))
sectors = shuffle!(filter!(s -> dim(s) < maxdim, sectors))
return resize!(sectors, min(size, length(sectors)))
Comment thread
lkdvos marked this conversation as resolved.
end

function randsector(::Type{I}) where {I <: Sector}
Expand Down